What is wrong with Struct?
Joe English
jeenglis at alcor.usc.edu
Sat May 11 19:39:24 AEST 1991
storm at cs.mcgill.ca (Marc WANDSCHNEIDER) writes:
>
>What is wrong with the following delcaration in my file sim.h:
>
>typedef struct HP {
> int last;
> Eventtype items[MAXHEAP];
>} Heaptype;
>
>For some reason, this only works if I remove the MAXHEAP (which was #defined).
>Why?
That depends, of course, on what MAXHEAP was #defined *to*.
You didn't include the definition in your post, but this:
>Array bounds missing ] in function main.
looks familiar... A mistake that I frequently make is to
#define MAXTHING 256;
instead of
#define MAXTHING 256 /* Note: no semicolon here */
Remember that a macro definition consists of the entire
line. You may be getting "Eventtype items[MAXHEAP;];",
which is a syntax error.
--jeenglis at alcor.usc.edu
More information about the Comp.lang.c
mailing list