You could start with this simple organization and then modify it as you see fit:
main.c <-- this #include's other .h files
module1.h
module1.c
module2.h
module2.c
...
Compile each one and link them together:
Code:
bash$ gcc -c module1.c -o module1.o
bash$ gcc -c module2.c -o module2.o
bash$ gcc -o main main.c *.o
bash$ ./main
Each module looks something like this:
Code:
#include "module1.h"
#include <stdio.h> // If your module needs stdio, etc.
// etc...
Each module header looks like this:
Code:
int f1(); // E.g. this function defined in module1.c
And main looks like this:
Code:
#include "module1.h"
#include "module2.h"
//...
//etc
Once you have that basic structure, rename things, add on and remove as desired to make whatever organization you want. It is convenient to add include guards to header files so that the ordering does not matter. The following is the unofficial way to make an include guard. It is unofficial but every compiler supports it:
Code:
#pragma once
// Rest of header file