Re: gcc rejects enum/int compatibility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>   extern enum { red, green, blue } foo;
>   int foo = green;
> ...
> ...
> Please explain me what is wrong.

You are declaring `foo' twice, this works:

extern enum { red, green, blue } foo;

int bar = green;

int main(void)
{
  printf("bar = %d\n", bar);
  return 0;
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux