#include <stdio.h>
#include <stdlib.h>
void swap (int & a, int & b)
{
int x;
x = a;
a = b;
b = x;
}
void main()
{
int m, n;
m = 6; n = 7;
printf("m = %d and n = %d \n", m, n);
swap (m, n);
printf("m = %d and n = %d \n", m, n);
}
#include <stdio.h>
#include <stdlib.h>
void swap (int *a, int *b)
{
int x;
x = *a;
*a = *b;
*b = x;
}
void main()
{
int m, n;
m = 6; n = 7;
printf("m = %d and n = %d \n", m, n);
swap (&m, &n);
printf("m = %d and n = %d \n", m, n);
getchar();
}