Encoders
>
More...
>
C
>
Program
/* Function swap(&a,&b) to swap the values of two variables. */
#include <stdio.h>
void swap(int *num1, int *num2);
main()
{
int a=5, b=7;
swap(&a,&b);
printf("%d %d\n",a,b);
}
void swap(int *p, int *q)
{
int temp;
temp = *p;
*p = *q;
*q = temp;
}
|