c - C中常量的奇怪声明

标签 c constants

我真的不明白这里有什么区别

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/

相关文章:

c - 在 Windows 上为一个 libevent 绑定(bind)创建 3 个套接字?

c - MS-DOS 套接字库(C 语言)

c++ - 这个 C++ const 引用访问器接口(interface)习惯用法有什么问题吗?

c - C 读取十六进制数并验证其位数

c - 序列化二叉树?

在 C 中连接路径和文件名

JSP 中的 Java 常量

c++ - 在 C++ 中,堆分配的对象可以是 const 吗?

dart - Dart const类参数检查

C - 作为 void ptr 传递到 int 列表的 ptr 地址 - 使用 int 或 const int?