大哥为什么我这个程序的结果没有把a,b值互换# include void huhuan(int a,int b){int t;t = a;a = b;b = t;return;}int main(void){int i = 4;int j = 6;huhuan(i,j); printf("i = %d,j = %d\n",i,j);return 0;}

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 22:07:40
大哥为什么我这个程序的结果没有把a,b值互换#includevoidhuhuan(inta,intb){intt;t=a;a=b;b=t;return;}intmain(void){inti=4;in

大哥为什么我这个程序的结果没有把a,b值互换# include void huhuan(int a,int b){int t;t = a;a = b;b = t;return;}int main(void){int i = 4;int j = 6;huhuan(i,j); printf("i = %d,j = %d\n",i,j);return 0;}
大哥为什么我这个程序的结果没有把a,b值互换
# include
void huhuan(int a,int b)
{
int t;
t = a;
a = b;
b = t;
return;
}
int main(void)
{
int i = 4;
int j = 6;
huhuan(i,j);
printf("i = %d,j = %d\n",i,j);
return 0;
}

大哥为什么我这个程序的结果没有把a,b值互换# include void huhuan(int a,int b){int t;t = a;a = b;b = t;return;}int main(void){int i = 4;int j = 6;huhuan(i,j); printf("i = %d,j = %d\n",i,j);return 0;}
# include <stdio.h>
void huhuan(int *a, int *b)//
{
    int t;
    t = *a;//  
    *a = *b;//
    *b = t;//
    //return;
}
int main(void)
{
    int i = 4;
    int j = 6;
    huhuan(&i, &j);// 
    printf("i = %d, j = %d\n", i, j);
    return 0;
}