# include <stdio.h>
void exchange(int * p, int * q)
{
int t ;
t = *p ;
*p = *q ;
*q = t;
}
int main(void)
{
int a = 3;
int b = 5;
exchange(&a, &b);
printf("a= %d , b = %d", a, b);
return 0;
}
# include <stdio.h>
void exchange(int * p, int * q)
{
int t ;
t = *p ;
*p = *q ;
*q = t;
}
int main(void)
{
int a = 3;
int b = 5;
exchange(&a, &b);
printf("a= %d , b = %d", a, b);
return 0;
}
本文标题:利用指针交换两个值(C语言)
本文链接:https://www.haomeiwen.com/subject/rvqudxtx.html
网友评论