> 其他 >
编写交换两个变量值的函数,并调用该函数交换主函数中两个变量的值
C表示
人气:128 ℃ 时间:2020-04-10 08:09:54
解答
#include
void fun(int *a,int *b)
{
int temp ;
temp = *a ;
*a = *b ;
*b = temp ;
}
main()
{
int a=1;
int b=2;
fun(&a,&b);
printf("a=%d,b=%d",a,b);
}
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版