码迷,mamicode.com
首页 > 其他好文 > 详细

TYPDEF使用注意部分

时间:2017-10-07 17:29:48      阅读:98      评论:0      收藏:0      [点我收藏+]

标签:ati   def   oid   std   span   clu   ons   class   使用   

#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使用注意部分

标签:ati   def   oid   std   span   clu   ons   class   使用   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!