typedef 和 #define 修饰指针类型的区别
2013-08-06 22:55
155 查看
typedef 和 #define 二者修饰指针类型时,作用不同。
typedef int* pint; #define PINT int* const pint p; //p不可更改,p指向的内容可以更改,相当于int * const p; const PINT p; //p可以更改,p指向的内容不能更改,相当于 const int *p;
//或 int const *p; pint s1, s2; //s1和s2都是int型指针 PINT s3, s4; //相当于int * s3,s4;只有一个是指针
相关文章推荐
- typedef(自定义数据类型)与#define(宏定义)用法比较(前者定义指针比define好用)---(转载)
- 宏定义#define和类型定义typedef区别
- #define和typedef在定义指针类型上的优劣
- 整理:#define和typedefine的区别 以及const修饰指针的用法
- Typedef 指针、常量、类型名 与#define详解
- typedef(自定义数据类型)与#define(宏定义)用法比较(前者定义指针比define好用)---(转载)
- typedef(自定义数据类型)与#define(宏定义)用法比较(前者定义指针比define好用)
- typedef int(init_fnc_t) (void) 和 typedef int(*init_fnc_t) (void)函数类型和函数指针的区别
- 结构体struct的应用、结构体变量、结构体指针变量、结构体指针变量类型的区别
- #define 与 typedef区别(转)
- typedef和#define的用法与区别
- #define和typedef的区别
- 6.4.3 final修饰基本类型变量和引用类型变量的区别
- typedef和#define的用法与区别
- typedef定义的struct类型与struct定义的结构体变量在使用上的区别
- typedef和#define的用法与区别
- typedef和#define的区别
- Nginx阅读: typedef定义函数指针类型
- #define与typedef区别
- typedef和#define的用法与区别