cproject

What is a good project structure in C


I have been working in Java/J2ee projects, in which I follow the Maven structure. I want to develop [say a command line interpreter in linux {ubuntu}] in C. I never develop projects in C. I want to know what project structure I should follow.


Solution

  • There is no one "standard" for C project in this aspect. Certainly if your project is small, then frequently everything will be placed in a single directory.

    You can try to download some popular open-source C projects and take a look at their code.

    On a lower level, code should be modular. Each module (which in C is usually manifested in a data structure with a set of functions to act upon it) has its own pair of .h and .c files, with the .h file being the public interface visible to the clients of the module, and the .c file being the private implementation.