so I started programming in C. Now I have a problem with pointers:
int * diff(){
int array[2] = {1,2};
return array;
}
int main(int argc, char const *argv[]) {
int *p;
p = diff();
printf("%d\n", *(p));
printf("%d\n", *(p));
return 0;
}
So after starting the program. My terminal is showing the following:
1
0
So why is the Value of *p changing ?