Code:
struct SPOT { // defines a global struct type named "SPOT"
int x;
int y;
char name[10];
};
struct SPOT myspot;
function main()
{
video_mode = 7;
screen_color.blue = 1;
// Define a local struct
struct SPOT {
int x;
int y;
char name[10];
};
struct SPOT myspot;
myspot.x = 10; // **
myspot.y = 20; // **
}
In the above code, I've defined 2 structs with the same name,
one is global struct and the other is local struct, and it
compiles and run without problem. I can access the local struct
members with the line //** but is there anyway to access the global
struct members? If not, why not throw a warning message?
Thanks.