hi all,
i have a doubt for this simple program. i'm passing just a copy of p to changeNum function. why is it changing the original? i know its pretty silly but i can't understand this. please tell me. One more question is if ihave int **ptr, how to pass ptr to a function so it can change the value. thanks in advance.
Code:#include <stdio.h> void changeNum(int *); int main(void) { int i = 0; int *p; p = &i; printf("*p is %d\n", *p); changeNum(p); printf("*p is %d\n", *p); return 0; } void changeNum(int *p) { *p = 10; }