#include <iostream>
#include <stdlib.h>
using namespace std;
void swap(int *t1, int *t2)
{
int *t;
t=(int *)malloc(sizeof(int));
*t=*t1;
*t1 = *t2;
*t2 = *t;
}
int main()
{
int x=1,y=2;
cout<<x<<y<<endl;
swap(&x,&y);
cout<<x<<y<<endl;
cout << "Hello world!" << endl;
return 0;
}
C语言交换变量之临时变量使用指针
最新推荐文章于 2022-12-31 10:52:08 发布