www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/01/16:30:06

From: "Steve Dondley" <stevedondley AT mediaone DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Type casting and pointers
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <wyZ97.2407$n_3.3163465@typhoon.ne.mediaone.net>
Date: Wed, 01 Aug 2001 20:22:52 GMT
NNTP-Posting-Host: 66.31.252.175
X-Complaints-To: abuse AT mediaone DOT net
X-Trace: typhoon.ne.mediaone.net 996697372 66.31.252.175 (Wed, 01 Aug 2001 16:22:52 EDT)
NNTP-Posting-Date: Wed, 01 Aug 2001 16:22:52 EDT
Organization: Road Runner
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello,

I've got a newbie C question.  I've got a beginner's C book that doesn't
explain something very well. Example code from the book:

float *p;
float balance[10][5];
...assignment stuff here...
p = (float *) balance;

My code works just fine without the (float *) type cast, but I do get a
warning.  Why exactly do you need it?  Doesn't declaring *p as a float
pointer at the top of the source take care of that?  The book also never
explains what exactly the asterisk in (float *) is.  I'm just assuming it
type casts the pointer.

Can someone please provide some elucidation?  Thanks!

---Steve



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019