Mail Archives: djgpp/1997/03/01/21:25:01

From: gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP Structs
Date: 2 Mar 1997 00:53:36 GMT
Organization: Oxford University
Lines: 21
Message-ID: <5faj2g$>
References: <01bc2673$a4dbe420$8e54dec2 AT satan>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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.

- Raw text -

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