#include<stdio.h>

int main() {
    int a,b,temp;
    int *ptr1, *ptr2;

    printf("Enter the values of a and b: \n");
    scanf("%d %d",&a, &b);

    printf("Before swapping a= %d and b=%d\n",a,b);
    ptr1=&a;
    ptr2=&b;

    temp= *ptr1;
    *ptr1= *ptr2;
    *ptr2= temp;

    printf("After swapping a is %d and b is %d", a ,b);
    
    return 0;
}

Embed on website

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