How to write a c program to swap two numbers without using third variable in C programming ?
C program to swap two numbers.Solution:
#include <stdio.h>
void swap(int *a, int *b);
int main ()
{
int x = 10, y = 20;
swap(&x, &y);
printf("%d %d\n", x, y);
return 0;
}
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}