对指针的理解,期待高手的回答!
这个是C prime plus这本宝典书中的例子,虽说是运行结果对了,还是没太想明白到底是怎么换的!#include <stdio.h>
int interchange(int u, int v);
int main(void)
{
int x=5,y=10;
printf("Originally x = %d and y = %d.\n",x,y);
interchange(&x,&y);
printf("Now x = %d and y = %d.\n",x,y);
return 0;
}
int interchange(int * u, int * v)
{
int temp;
temp = *u;
*u = *v;
*v = temp;
}