Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the standard way of naming source files in C? [closed]

Is there a standard way of naming source code files in C?

E.g. Should they be underscore separated, capitalized, camel case?

like image 810
jsj Avatar asked Oct 10 '12 06:10

jsj


2 Answers

There is no standard, but many C projects use lowercase filenames, separating words with underscores. The main thing is to be consistent though.

like image 118
mattcawley Avatar answered Sep 28 '22 02:09

mattcawley


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.

like image 28
Jonathan Leffler Avatar answered Sep 28 '22 04:09

Jonathan Leffler