实践题目——指针及其运算

来源:互联网 发布:贵州大数据 编辑:程序博客网 时间:2024/06/06 08:41

【程序阅读题】

写出以下程序运行的结果,上机对照结果后,解释其过程。(注意用手画内存变化过程,而不要仅凭大脑思考。)

#include <stdio.h>int main(){    int *p1,*p2,*p;    int a=5,b=8;    p1=&a;    p2=&b;    if(a<b)    {        p=p1;        p1=p2;        p2=p;    }    printf("%d,%d\n",*p1,*p2);    printf("%d,%d\n",a,b);    return 0;}

参考:执行过程
这里写图片描述

原创粉丝点击