Im working with straight C code, on a project with 5 .c files.
I have put all my #includes (windows.h, stdlib.h, stdio.h, strings.h, etc) at main.h so that all my .c files only have to #include main.h, I thought that was the easier way to do it. This main.h file has also all the global vars and the prototypes for all the functions on all the .c files.
I was thinking maybe the most correct thing would be to have one .h for each .c file with its prototypes, am i thinking correctly?
But then what would i do? All .c files would have to #include main.h and its own .h? Or do i #include all this new function prototypes .h files at main.h too?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Im working with straight C code, on a project with 5 .c files.
I have put all my #includes (windows.h, stdlib.h, stdio.h, strings.h, etc) at main.h so that all my .c files only have to #include main.h, I thought that was the easier way to do it. This main.h file has also all the global vars and the prototypes for all the functions on all the .c files.
I was thinking maybe the most correct thing would be to have one .h for each .c file with its prototypes, am i thinking correctly?
But then what would i do? All .c files would have to #include main.h and its own .h? Or do i #include all this new function prototypes .h files at main.h too?