Re: syntax errror



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
.



Relevant Pages

  • Re: syntax errror
    ... >>ImageT ImageTvar; ... I was using gcc at the time. ... Decode email address using b64decode or uudecode -m ... strip view finger mount fcsk more fcsk yes spray umount sleep ...
    (comp.lang.c)
  • syntax errror
    ... there is an error messege saying: ... error: syntax error before 'ImageT' ...
    (comp.lang.c)
  • Re: syntax errror
    ... > there is an error messege saying: ... You defined a structure type and gave it a typedef name ImageT. ... Prev by Date: ...
    (comp.lang.c)
  • Re: syntax errror
    ... > int height; ... > error: syntax error before 'ImageT' ...
    (comp.lang.c)
  • Re: syntax errror
    ... danu wrote: ... Because ImageT is a type, ... Prev by Date: ...
    (comp.lang.c)