解读C++声明
来源:互联网 发布:家庭ktv点歌软件 编辑:程序博客网 时间:2024/06/17 03:16
char *const cp ; // const pointer to char char const * pc ; // pointer to const charconst char * pc2 ; // pointer to const char
Some people find it helpful to read such declarations right to left. For example, "cp is a const pointer to a char" and "pc2 is a pointer to a char const ."
如何复杂的表达式声明,掌握了方法一样可以读出来。首先,()和[]具有比*更高的优先级。因此先读[],读作 array of,*读作pointer to。当然()具有最高的优先级,如果()里没有内容类似 returntype (* function)()的,读作function。
char (*(*x())[])(),从里面往外读 , x is a function returning pointer to D,读到这里可以进行一个简化, char(*D)[](),继续读,D is array of function returning char。因此: function returning pointer to array[] of pointer to function returning char
char (*(*x[3])())[5] --->> char(*D)())[5],x is array3 of pointer to , D is function return char[5]。
这是我比较好理解的方法,写的也比较粗糙。更详细请参考这里:
http://blog.chinaunix.net/u/12783/showart_378340.html
- int
- int *
- int *[3]
- int (*)[]
- int *()
- int (*[])(void)
- 解读C的声明
- C语言声明解读规则
- C语言声明解读步骤
- C语言声明解读步骤
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C语言 声明的一般 解读 方法
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C指针声明解读之左右法则
- C语言总结之解读C的声明
- CP Socket编程 C/C++实现 (Windows Platform SDK)
- 报表ReportViewer显示图片--rdlc
- 我的青春谁做主--精彩语录
- 打印自身源代码的程序,一个通用方法
- 如何用vc创建和读取xml文件??
- 解读C++声明
- WINCE600的目录组织及PQOAL
- 当心编译器生成的隐含成员函数
- 怎么在vmware下linux实现上网
- C++中的dynamic_cast
- 谈谈C#中的泛型
- CAPI&CAPICOM的一些知识
- Struts SXT视频学习笔记
- Head First SQL 中文版 Page 69-73