r/C_Programming • u/iper_linuxiano • Jul 10 '26
Question C programming style
Hi all, in my opinion choosing a valid C programming style may help people to maintain code. I know that freedom is a plus, especially for code creators, but it may become a real nightmare for code maintainers.
In my work experience I always tried to keep a uniform code style even if I work by myself, but, after six months I create a software, if I don't use a code style I lose so much time to correct my own code that sometimes I create it newly from scratch.
My question is: are there any places where programmers share their code styles, or some advices (especially variable or typedef names) based upon their real work experience?
Thanks in advance to anyone who will answer! Cheers!
View all comments
Show parent comment
6
u/sirjofri Jul 10 '26
Just one additional tip, which I learned from Plan 9 C: if you format function definitions (not pure declarations) like this:
You can easily find that function using
grep '^myfunction'. (On Plan 9 even easier using thegwrapper, which outputs line numbers so you can easily jump to the function in your editor, but that's only a side node.)Other than that, that's pretty close to my style, too.
(Besides, for argv I tend to use
**argv, but that's just personal taste)