#include <stdio.h>

void sp(int **p1, int **p2)
{
    int * temp = *p1;
    *p1=*p2;
    *p2=temp;
}

int main() {
    int num1 = 10, num2=20;
    int *ptr1, *ptr2;
    ptr1=&num1, ptr2=&num2;
    printf("*ptr1, *ptr2: %d %d \n", *ptr1, *ptr2);


    sp(&ptr1, &ptr2);
    printf("*ptr1, *ptr2: %d %d \n", *ptr1, *ptr2);
        return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: