delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/26/21:47:06

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: arrays of pointers
Date: Sun, 26 Oct 1997 14:09:32 -0800
Organization: Alcyone Systems
Lines: 29
Message-ID: <3453BF9C.569ABA25@alcyone.com>
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>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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.

-- 
         Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
                       Alcyone Systems / http://www.alcyone.com/max/
  San Jose, California, United States / icbm://+37.20.07/-121.53.38
                                     \
  "After each war there is a little / less democracy to save."
                                   / Brooks Atkinson

- Raw text -


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