Well, I'm learning C, and I was reading this tutorial on pointers, and I wrote a small program myself. This is it:
Compile goes fluently, and it WORKS?? I just don't understand, I'm sorry. Isn't this supposed to fail. (As the tutorial says, the pointer points to a local variable, which is distroyed at the moment of the printf ...#include <stdio.h>
int *pPointer;
void SomeFunc(void){
int Number = 15;
pPointer = &Number;
}
void main(void){
SomeFunc();
printf("Value of pPointer: %d\n", *pPointer);
}