Does the following code make p as a null pointer
static int *p;
since
outputs as 0Code:printf("%u",p);
though the syntax is
Code:int *p=NULL or int *p=0
Does the following code make p as a null pointer
static int *p;
since
outputs as 0Code:printf("%u",p);
though the syntax is
Code:int *p=NULL or int *p=0
This is from the C11 Standard
10 If an object that has automatic storage duration is not initialized explicitly, its value is
indeterminate. If an object that has static or thread storage duration is not initialized
explicitly, then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
— if it is an aggregate, every member is initialized (recursively) according to these rules,
and any padding is initialized to zero bits;
— if it is a union, the first named member is initialized (recursively) according to these
rules, and any padding is initialized to zero bits;
Fact - Beethoven wrote his first symphony in C