#include<stdio.h>
swap(int *a,int *b) //为什么写成 void swap(.....)可以,写成int swap(....)就不可以了
{
int t ;
t=*a;
*a=*b;
*b=t;
}
int main()
{
int a=3;
int b=5;
swap(&a,&b);
printf("%d,%d\n",a,b);
}
swap(int *a,int *b) //为什么写成 void swap(.....)可以,写成int swap(....)就不可以了。
通过一个函数调换两个数
最新推荐文章于 2023-01-12 10:47:57 发布