www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/02:57:50

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP Structs
Date: 3 Mar 1997 04:57:34 GMT
Organization: The National Capital FreeNet
Lines: 37
Message-ID: <5fdlnu$mdt@freenet-news.carleton.ca>
References: <01bc2673$a4dbe420$8e54dec2 AT satan> <5faj2g$j35 AT news DOT ox DOT ac DOT uk>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet5.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot (gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk) writes:
> Iain Buchanan (Iain AT BuchananFamily DOT demon DOT co DOT uk) wrote:
> 
> : And an array full of pointers to such structres:
> : defPt *View[25][25];
> 
> : When I try and do this.... ("x" and "y" are of type int, and each go from
> : 0-24)
> : defPt *View[x][y] = calloc(1, sizeof(defPt));
> 
> Hmm. This is using a Gnu C extension (variable sized arrays), which isn't
> what you intended. At this stage you are declaring a two dimensional array
> of pointers, with size x is one direction and y in the other. Since you've
> already defined the array (haven't you?), what you meant was probably:
> 
> View[x][y] = (defPt *)calloc(1,sizeof(defPt));
> 
> I hope this helps.
> 
> -- 
> George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
> Merton College, Oxford.


And shouldn't he either be saying struct defPt *, or else

typedef struct defPt {
   ...
} defPt;

?
--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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