I'm new to C so I know what a pointer is but I'm not convenient with the topic yet.
#include "stdio.h"
#include "stdint.h"
int *value(void) {
int i=3;
return &i;
}
void valueTwo(void) {
int x=35;
}
main() {
int *ip;
ip=value();
printf("*ip is %d\n", *ip);
valueTwo();
printf("*ip==%d\n",*ip);
}
The above code prints *ip is 3 *ip is 35
What I do not understand is why *ip has changed from 3 to 35. From what I understand, this means the value at the address &i has been changed from 3 to 35. However, I don't understand how 35 got into that address. Can anyone explain? Thanks!