Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要知道函数和结构名称的命名约定以及根据 ANSI C 标准。
我读到第一个字母应该以小写字母开头。我可以使用驼峰式命名还是应该在两个单独的之间使用下划线。例如: print_char 或 printChar 我需要知道标准状态是什么?
ANSI C 标准提供的约定方式很少,只有规则。函数、类型和变量标识符可以使用任何字母数字符号 A-Za-z0-9 和下划线 _。名称不能以数字开头。这不是一个约定,而是对合法名称的定义。
我知道的唯一约定是建议避免使用以 _ 开头并以 _t 结尾的名称。由于标准保留这些以供将来使用。