How are pointers in C initialized? It seems like previous declarations change how they are initialized.
Consider the following example:
int *a;
printf("a: %p\n", (void*)a);
This code snippet results in
a: (nil)
So one could think that variables at function start are initialized with null, but if I execute this code:
int *a;
for(int i = 0; i < 1; i++){
int *b;
printf("a: %p\n", (void*)a);
printf("b: %p", (void*)b);
}
This is the result:
a: 0x7ffff3bb2e40
b: (nil)
How can I determine how the variables are initialized?