TYPDEF使用注意部分

#include <stdio.h>

typedef int* INT;

int main(void)
{
   const INT a;
   const int* b;

   *a = 2;
   b = NULL;
   *b = 3;

   return 0;
}

打印结果:

tmp.c:12:4: error: assignment of read-only location ‘*b’
*b = 3;

const INT a;

const int* b;

这两个结果是不一样的,第一个a的值不能改变,第二个*b的值不能改变

原文地址:https://www.cnblogs.com/Deanboy/p/7634894.html