传地址和传值的问题
#include "stdio.h"
#include "conio.h"
#define swap(x,y){ \
int t; \
t=x; \
x=y; \
y=t; \
}
main()
{
int a,b;
a=5,b=9;
swap(a,b);
printf("%d,%d",a,b);
getch();
}
以上程序在wintc中运行结果为:9,5,而下面的程序结果却为:5,9,请问为什么,另外上面的程序的5个"\"是干什么用的?
#include "stdio.h"
#include "conio.h"
void swap(int x,int y){
int t;
t=x;
x=y;
y=t;
}
main()
{
int a,b;
a=5,b=9;
swap(a,b);
printf("%d,%d",a,b);
getch();
}