编写交换两个变量值的函数,并调用该函数交换主函数中两个变量的值

学习 时间:2026-04-01 10:41:57 阅读:9270
编写交换两个变量值的函数,并调用该函数交换主函数中两个变量的值C表示

最佳回答

执着的歌曲

顺心的宝马

2026-04-01 10:41:57

#includevoid 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);}

最新回答共有2条回答

  • 勤劳的音响
    回复
    2026-04-01 10:41:57

    #includevoid 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);}

上一篇 Can you make a cake or not?如何回答

下一篇 [-B35] Today we'll talk about a great many cases ------ begi