#include #include //include stdlib for malloc() int *p1,*p2; //make pointers global void fun(void); //No need to pass any arguments, as p1,p2 are global int main(void) { int s; fun(); s=*p1 + *p2; printf("Sum= %d",s); return 0; } void fun(void) { p1=malloc(sizeof(int)); //allocate memory to use it outside fun() p2=malloc(sizeof(int)); *p1=3; *p2=5; }