cstructanonymousanonymous-struct

Anonymous C struct with declaration


Considering the following definition:

struct
{
    int x;
    int y;
} point;


void main()
{ 
    ...
}

You're declaring the variable "point" of "anonymous struct" type, is there any way to declare another variable of the same type outside the struct definition (maybe in main function)?


Solution

  • No, there isn't, at least not in standard C. If you want to use the type, you have to give it a name.