posted @ 2011-10-20 13:13 猫少侠 阅读(757) 评论(5) 推荐(0)
摘要:
1.下面的代码中编译器会报一个错误,你知道是哪个语句错了吗?typedef char * pStr;char string[4] = "abc";const char *p1 = string;const pStr p2 = string;p1++;p2++; 是p2++出错了。这个问题再一次提醒我们:typedef和#define不同,它不是简单的文本替换。上述代码中const pStr p2并不等于const char * p2。const pStr p2和const long x本质上没有区别,都是对变量进行只读限制,只不过此处变量p2的数据类型是我们自己定义的而不是 阅读全文
浙公网安备 33010602011771号