2 votes 2 votes #include <stdio.h> void fun(int* p) { *p = 10; } void fun1(int *p) { int a = 10; p = &a; } int main() { int x = 30; int *p = &x; fun1(p); printf("%d\n",*p); // output = 30 fun(p); printf("%d",*p); // output = 10 } Programming in C programming programming-in-c pointers + – robertSingh asked Sep 28, 2016 robertSingh 271 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply dd commented Sep 28, 2016 reply Follow Share https://gateoverflow.in/65830/pointers 0 votes 0 votes dd commented Sep 28, 2016 reply Follow Share fun1() is assigning local varibale a's address to its local pointer p, all these does not have any effect after fun1() returns. But inside fun() we have changed the x value (in the main() ) pointed by p (although local). 0 votes 0 votes Please log in or register to add a comment.