
一、前言1、在公司做项目时使用公司的 C 语言编码规范即可。2、如果公司没有编码规范可以参考下面的编码规范避免变量满天飞、代码混乱等问题形成良好的编码习惯。3、个人在私下进行学习时也可以参考下面的编码规范。二、C 语言个人编码规范博客上面文章看起来比较乱需要调整格式比较麻烦个人直接做成了pdf有需要的小伙伴可百度云盘自提。通过网盘分享的文件c语言个人编码规范.pdf链接: https://pan.baidu.com/s/1paHekj4YcKKnF135U8iBzg?pwdds39 提取码: ds39三、C 语言编码模板1、template.c//-----------------------------------------------------------------------------// Include//-----------------------------------------------------------------------------// self module#includetemplate.h// other module// muc/soc module// rtos module// c standard lib module//-----------------------------------------------------------------------------// Macro Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Extern Variable//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Extern Function//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Enum Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Struct Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Static Function Declaration//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Static Variable//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Global Variable//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Static Function Implementation//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Public Function Implementation//-----------------------------------------------------------------------------2、template.h#ifndef__TEMPLATE_H__#define__TEMPLATE_H__//-----------------------------------------------------------------------------// Include//-----------------------------------------------------------------------------// self module// other module// muc/soc module// rtos module// c standard lib module#includestdint.h//-----------------------------------------------------------------------------// Macro Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Extern Variable//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Enum Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Struct Define//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// Public Function Declaration//-----------------------------------------------------------------------------#endif