- #include
- int main()
- {
- int *p1, *p2, *p, a, b;
- scanf("%d %d", &a, &b);
- p1 = &a;
- p2 = &b;
- if (a
- p = p1;
- p1 = p2;
- p2 = p;
- }
- printf("a = %d, b= %d\n", a, b);
- printf("max=%d, min=%d\n", *p1, *p2);
- return 0;
- }

- #include
- int main(){
- void swap(int * p1, int *p2);
- int a, b;
- int *point_1, *point_2;
- printf("Please input two numbers:\n");
- scanf("%d %d", &a, &b);
- point_1 = &a;
- point_2 = &b;
- printf("a=%d, b=%d\n", a, b);
- printf("point1===%d, point2===%d\n",point_1,point_2);
- if (a
- swap(point_1, point_2);
- }
- printf("After exchanged:\n");
- printf("a=%d, b=%d\n", a, b);
- return 0;
- }
-
- void swap(int *p1, int *p2)
- {
- int tmp;
- printf("function start: p1===%d, p2===%d\n",p1, p2);
- printf("function start: *p1===%d, *p2===%d\n",*p1, *p2);
- printf("tmp=%d\n",tmp);
- tmp = *p1;
- printf("tmp=%d\n",tmp);
- *p1 = *p2;
- *p2 = tmp;
- printf("function end: p1===%d, p2===%d\n",p1, p2);
- printf("function end: *p1===%d, *p2===%d\n",*p1, *p2);
- }

-
相关阅读:
【TS】函数重载--可选参数--默认参数
Vue监测数据的原理(对象、数组)、Vue.set()、vm.$set()
学不会PDF裁剪与PDF拆分?6个方法包你轻松学会
2022.11.7-11.13 AI行业周刊(第123期):技术人员的职业发展在哪里?
嵌入式分享合集37
springboot初试elasticsearch
vlc播放网络数据流
strcpy, strcat,strcmp的介绍和模拟实现
数据库的下载、安装与配置
SSM框架-SpringMVC(一)
-
原文地址:https://blog.csdn.net/DeniuHe/article/details/139723550