#White space convention for C
17 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
do whatever you want
what does the C standard say?
or is there any other standard (like google) that I can refer to
just want to stick to convention
these are stylistic choices, afaik no comments are made in the standard
use a style you like, if you're working on another codebase then use thei rstyle
to make life easier, use a formatter like clang-format
they mean the same thing and both are acceptable, although all the code examples in the standard consistently use spaces like c = 0
i wouldn't do c=0 for variables with a name longer than 1 letter
Use spacing to improve the readability of the code. For simple initialization, it doesn't matter. You can prefer anything.
c = 0; better readability of symbols. don't be shy about using lots of whitespace... use as much as you want.
!solved