摘要: 一、typedef与宏的不同 主要体现在两方面: 首先,可以用其他类型说明符对宏类型名进行扩展,但对typedef所定义的类型名却不能这样做。#define peach intunsigned peach i; //No problemtypedef int banana;unsigned banana i;//error illegal 其次,在连续几个变量的声明中,用typedef定义的类型能够保证声明中所有的变量均为同一类型,而用#define 定义的类型则无法保证。#define int_ptr int*int_ptr chalk, cheese;备注:chalk 是int*型,... 阅读全文
posted @ 2013-05-22 10:29 wiessharling 阅读(199) 评论(0) 推荐(0)