我真的不明白这里有什么区别
const int a = 1;
int const a = 1;
我知道常量是什么,但上面的例子让我很困惑。
最佳答案
没有区别。两者相同。
n1570 草案:6.7.2 类型说明符:
Type specifiers are
void
,char
,short
,int
,long
,float
,double
,signed
,unsigned
,_Bool
,_Complex
,<struct-or-union-specifier>
,<enum-specifier>
, and<typedef-name>
.At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct declaration and type name. Each list of type specifiers shall be one of the following multisets (delimited by commas, when there is more than one multiset per item); the type specifiers may occur in any order1, possibly intermixed with the other declaration specifiers.
1.重点是我的
关于c - C中常量的奇怪声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20401911/