} int main(void) { int *x,*y; x = (int *)malloc(sizeof(int)); y = (int *)malloc(sizeof(int)); /*check if malloc is successful*/ if(x == NULL || y == NULL) { return -1; } else { printf("The address x pointed to is %d
",x); printf("The address y pointed to is %d
",y); *x = 1; *y = 2; swap(x,y);/*call function*/ printf("The address x pointed to is %d
",x); printf("The address y pointed to is %d
",y); printf("x is %d
",*x); printf("y is %d
",*y); free(x); free(y); x = NULL; y = NULL; int a = 100; int b = 200; swap(&a,&b);/*call function*/ printf("a is now %d.
",a); printf("b is now %d.
",b); return 0; } }