Mail Archives: djgpp/1997/03/03/02:57:50
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 -