編碼如下:
#include <stdio.h>
void swap(int* x,int* y ){
int tmp;
tmp=*x;
*x=*y;
*y=tmp
;
};
int main()
{
int a=4;
int b=5;
printf("befer\n");
printf("a=%d\n",a);
printf("b=%d\n",b);
swap(&a,&b);
printf("after\n");
printf("a=%d\n",a);
printf("b=%d\n",b);
return 0;
}
輸出的結果:
befer
a=4
b=5
after
a=5
b=4
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/553717.html
標籤:C
上一篇:【QCustomPlot】性能提升之修改原始碼(版本 V2.x.x)
下一篇:返回列表