Organizing a C Project
It is a good practice to manage groups of C files in an organized manner. It will be much easier to design, implement and maintain :)
The key point is to separate the function declarations and definitions into multiple files (Not a single C file)

Consider the following scenario :
we have two functions, namely add_int() and multi_int(),
The best practice is to put the declarations into header files:
int_header.hDeclaration of the function prototypes of
add_int()andmulti_int().
Then put the definitions into seperate C files:
add_int.cDefinition of the function
add_int()only.
multi_int.cDefinition of the function
multi_int()only.
Finally invoking the functions in the main function.
To compile it using:
It will show warnings: 
As the OS cannot find the definition of add_int() and multi_int(). You have to add the #include:
So the pre-processor (still remember?) will expand the #include.
To sum up, to compile a large C project, one of the ways is:

Last updated