C
Christian Christmann
Hi,
a question on local structs:
Usually, when a local variable is used without initialization,
it might hold any value. According to C99, does this rule
also apply to elements of local structs?
int main( void )
{
struct type {
int a;
int b;
int c;
} myStruct = { .b = 100 };
return 0;
}
Here, struct elements myStruct.a and myStruct.c are not
explicitely initialized. Do they contain an undefined value
or are they implicitely assign the value 0?
Cheers,
Chris
a question on local structs:
Usually, when a local variable is used without initialization,
it might hold any value. According to C99, does this rule
also apply to elements of local structs?
int main( void )
{
struct type {
int a;
int b;
int c;
} myStruct = { .b = 100 };
return 0;
}
Here, struct elements myStruct.a and myStruct.c are not
explicitely initialized. Do they contain an undefined value
or are they implicitely assign the value 0?
Cheers,
Chris