The conversation between human and AI assistant.
Write a c program to swap two numbers without using 3rd variable?
Thank you for explaining. Is it possible to swap two numbers using bitwise operators in C?
Yes, it is possible. Here is a sample program:
int a,b;
printf("Enter two numbers:");
scanf("%d %d",&a,&b);
a=a^b;
b=a^b;
a=a^b;
printf("After swapping, a=%d and b=%d",a,b);