指针表示变量

运用指针可以表示一个变量,申请一个动态的地址空间:如下

#include "stdio.h"
int main()
{
    int *p;
    p = (int *)malloc(4);
    *p = 10;
    printf("%d", *p);
    return 0;
}

这个并没有直接利用int p,而是利用指针来实现打印一个变量的,嘻嘻。

猜你喜欢

转载自blog.csdn.net/qq_38762390/article/details/84642313