#include <stdio.h>
void swap(int & a, int & b)
main() { int i = 10; int j = 20; printf("i = %d, j = %d",i, j); swap(i, j); printf("i = %d, j = %d",i, j); }
void swap(int & a, int & b) { int t; t = a; a = b; b = t; }
#include <stdio.h>
void swap(int & a, int & b) ; //原形说明后面要加上 ;
void main() //VC中不写要警告
{
int i = 10;
int j = 20;
printf("i = %d, j = %d",i, j);
swap(i, j);
printf("i = %d, j = %d",i, j);
}
void swap(int & a, int & b)
{
int t;
t = a;
a = b;
b = t;
}