In your code fragment, event
is an instance of an unnamed structure, an uninitialized global variable. At global scope, uninitialized objects have all members initialized to the zero value for their type.
The function function()
can use the event
name to refer to this object and assign a value to one of its members: event.eventNum = 10;
.
You may have seen initialized structure definitions like this:
struct {
int eventNum;
int eventType;
} event = { 10, 0 };
Or C99 specific initalizers like this:
struct {
int eventNum;
int eventType;
} event = { .eventNum = 10 };
These definitions can occur at global or local scope and define an initialized object event
.