Is there a standard way of naming source code files in C?
E.g. Should they be underscore separated, capitalized, camel case?
There is no standard, but many C projects use lowercase filenames, separating words with underscores. The main thing is to be consistent though.
There's no mandatory convention. In part, it depends on whether your system has a case-sensitive or case-insensitive file names.
The .c
suffix (lower-case) is essentially universal for source files, and the .h
for header files. Other files included in source files may have different extensions, or no extension at all.
Classically, the names were all lower-case (look at the standard header names, for example). The names avoid accented characters, spaces and many other punctuation characters, usually adhering to the portable filename character set (alphanumerics, underscore, dash, dot). Other than that, the choice is largely up to you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With