Re: syntax errror
- From: Daniel Rudy <spamthis@xxxxxxxxxxxx>
- Date: Fri, 02 Dec 2005 08:32:57 GMT
At about the time of 12/1/2005 3:53 PM, danu stated the following:
> I have a structure :
>
> typedef struct{
> char magicNum[2];
> int width;
> int height;
> int maxGrey;
> int pixels[ROW][COLUMN];
> } ImageT;
>
> When I try to code this statement:
>
> fscanf(infile, "%c", ImageT.magicNum[0]);
>
> there is an error messege saying:
>
> error: syntax error before 'ImageT'
>
> What's the reason for that? What am I doing wrong here?
> thanks.
>
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]);
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?
--
Daniel Rudy
Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m
Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
.
- Follow-Ups:
- Re: syntax errror
- From: Keith Thompson
- Re: syntax errror
- References:
- syntax errror
- From: danu
- syntax errror
- Prev by Date: Re: [OT] Finding stuff in the standard
- Next by Date: Re: syntax errror
- Previous by thread: Re: syntax errror
- Next by thread: Re: syntax errror
- Index(es):
Relevant Pages
|