Re: syntax errror
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 02 Dec 2005 09:17:20 GMT
Daniel Rudy <spamthis@xxxxxxxxxxxx> writes:
[snip]
>
> Personally, I see a couple of problems with this (someone please correct
> me if I'm wrong).
>
> typedef struct ImageT_tag__ {
> char magicNum[2];
> int width;
> int maxGrey'
> int pixels[ROW][COLUMN];
> } ImageT;
>
>
> ImageT ImageTvar;
>
> fscanf(infile, "%c", &ImageT.magicNum[0]);
This fixes the type error from the original code, but it has the same
problem that it uses ImageT as if it were a variable name, when in
fact it's a type name. Presumably you meant
fscanf(stdin, "%c", &ImageTvar.magicNum[0]);
It's always a good idea to compile your code before posting it; that
would have caught both this error and the syntax error in the
declaration of maxGrey.
> Now this brings up a very interesting question in C89. I've actually
> had code that refused to compile unless I placed an identifier after the
> struct. Is that part of the standard, or is it just a gcc thing?
As far as I know, it's neither. Can you show an example?
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: syntax errror
- From: Daniel Rudy
- Re: syntax errror
- References:
- syntax errror
- From: danu
- Re: syntax errror
- From: Daniel Rudy
- syntax errror
- Prev by Date: Re: syntax errror
- Next by Date: Re: Size of Stucture without sizeof()
- Previous by thread: Re: syntax errror
- Next by thread: Re: syntax errror
- Index(es):