//将输入的数字进行调换
#include<stdio.h>
void swap(int *pt1, int *pt2);
int main(void)
{
int x, y, *p1, *p2;
printf("please input two number: ");
scanf("%d,%d", &x, &y);
p1 = &x;
p2 = &y;
swap(p1,p2);
printf("%d,%d", x, y);
return 0;
}
void swap(int *pt1, int *pt2)
{
int temp;
temp = *pt1;
*pt1 = *pt2;
*pt2 = temp;
}
本文转自 tiger506 51CTO博客,原文链接:http://blog.51cto.com/tiger506/434737,如需转载请自行联系原作者