delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/02/01:50:33

From: brettk AT compusmart DOT ab DOT ca (Brett Kosinski)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: arrays of pointers
References: <199710250713 DOT UAA05511 AT fep1-orange DOT clear DOT net DOT nz> <slrn657ct7 DOT 235 DOT brettk AT talisman DOT dyn DOT ml DOT org> <3453BF9C DOT 569ABA25 AT alcyone DOT com>
Reply-To: brettk AT compusmart DOT ab DOT ca
Message-ID: <slrn65jvq9.8mo.brettk@talisman.dyn.ml.org>
NNTP-Posting-Host: remote455.compusmart.ab.ca
Date: 31 Oct 97 15:55:34 GMT
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Erik Max Francis <max AT alcyone DOT com> wrote:
>Brett Kosinski wrote:
>
>> Actually, I believe this is correct.  Are you sure you are malloc'ing
>> the
>> pointers before trying to access them?
>
>Yes, it's correct.
>
>> *tiledata[ptrNum][dataNum].dat <-- you have to dereference the
>> pointer.
>
>This is incorrect.  . has higher precedence than *, so this is
>syntactically wrong.  What you meant is 
>
>    (*titledata[ptrNum][dataNum]).dat, 
>
>or more appropriately, 
>
>    titledata[ptrNum][dataNum]->dat, 
>
>which is what the -> operator is for.

I thought I did that wrong... oh well, my C is a little bit rusty... (I have
to use Pascal in Comp Sci, so C has been on the backburner for a while now. :)

Brett.

- Raw text -


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