zhuang@linux:~/notes/c-coding-style/$ cat

C Coding Style

$ grep tags c-coding-style.md

Keep the code elegant. Some good C coding style is concluded here.

Header File Order

c
#include "user.h"        // 1. according current .c  

#include <unistd.h>      // 2. system header files, c std lib 
#include <errno.h>       
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <mysql/mysql.h> // 3. third-party

#include "db.h"          // 4. project-related 
#include "log.h"
#include "utils.h"

zhuang@linux:~/notes/c-coding-style/$ comments