使用函数实现两个数的交换。

来源:互联网 发布:cf占卜软件 编辑:程序博客网 时间:2024/04/27 23:45
//2.使用函数实现两个数的交换。
#include<stdio.h>
int swap(int *px, int *py)
{
int temp = 0;
temp = *px;
*px = *py;
*py = temp;
printf("a=%d,b=%d",*px,*py);
}


int main()
{
int a = 20;
int b = 0;
swap(&a, &b);
system("pause");
return 0;
}
0 0
原创粉丝点击