- #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);
- }

-
相关阅读:
python将.mat文件转换为.txt
html + thymeleaf 制作邮件模板
【CSS布局】结构伪类选择器、伪元素、浮动
JS语句完全攻略
异地工业设备集中运维、数据采集,一招搞定
详细了解一下股票量化交易接口股
SentenceTransformer 之论文解读
条件随机场CRF(持续更新ing...)
C++ “引用”究竟是什么?(代码实测)
【虹科案例】极高的精度水平——虹科数字化仪在大型强子对撞机机器保护系统中的应用
-
原文地址:https://blog.csdn.net/DeniuHe/article/details/139723550