#include #include //include stdlib for malloc() //make nothing global void fun(int**,int**); /*pass double pointers so that changes made to them are visible outside fun()*/ int main(void) { int s; int *p1,*p2; fun(&p1,&p2); //Address of p1 & p2 must be passed as they are single pointers s=*p1 + *p2; printf("Sum= %d",s); return 0; } void fun(int **dp1,int **dp2) { *dp1=malloc(sizeof(int)); //allocate memory to use it outside fun() *dp2=malloc(sizeof(int)); **dp1=3; **dp2=5; }