TYPDEF使用注意部分

Posted DeanBoyLoveLinux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的值不能改变

以上是关于TYPDEF使用注意部分的主要内容,如果未能解决你的问题,请参考以下文章