Nuts & Bolts of C - joyocaowei/joyocaowei.github.io GitHub Wiki
以下内容来自<C专家编程>中文版-page64
- 声明从它的名字开始读取,然后按照优先级顺序读取
- 优先级从高到低依次是:
- 声明中被括号括起来的那部分
- 后缀操作符: 括号()表示这是一个函数,方括号[]表示这是一个数组
- 前缀操作符: *表示"指向...的指针"
- 如果const或者volatile关键字后面紧跟类型说明符(如int、long等),那么它作用于类型说明符。 在其他情况下,作用于它左边紧邻的星号(*).
char * const *(*next)();
next is pointer to function returning pointer to const pointer to char.
char *(* c[10])(int **p)
c is array of 10 pointer to function returning pointer to char.
C provides an unary sizeof operator to get the size of the operand (in bytes). The following program uses sizeof operator to print the size of the fundamental types.
The sizeof is a keyword, but it is a compile-time operator that determines the size, in bytes, of a variable or data type.
You can find the array length using expression
sizeof(arrayName)/sizeof(arrayName[0])
, where sizeof(arrayName) returns the total bytes of the array and sizeof(arrayName[0]) returns the bytes of first element.