Ive been trying to get my code organized through various ways and I've found across various programs that I use the same functions that I have created, over and over again.
Of course copying and pasting code is not recommended ( and I still do it, I'm trying to avoid it >_<! ), So is there a way to organize my functions into .c files and #include them like any normal headers.
For example, I want to do this
#include <printFunctions>
NOT
#include "C:\Users\BlahBlah\printFunctions.c"
I dont want to be typing that out all the time!
Im using CodeBlocks at the moment!
One last question, what happens if I define a function and dont use it?
Im asking this because im not going to be using all the functions in the .c files
hmm Ive tried multiple things...Thanks for your posts though
What Im trying to do is make a bunch of header files to store my functions so that I can use them across multiple programs, HOWEVER, I want to also assign a name to the header files so i can say #include <test> ( or just "test.h" ) rather then having to give an entire file path.
It has a chapter which shows how to do header files in C (page 70). The declarations of variables & functions go in a .h file, while the code for those functions goes in a .c file.
If you are doing C++, the convention is to put class declarations in the .h file with definitions of the functions in a .cpp file.
In C & C++, one just creates a mess if one include files with non declarative code everywhere.
Bahah! A great response TheIdeasMan, I like how youve lead me to the original document by Dennis Ritchie himself! This is very helpful and I think it will help me format my code in other ways aswell, your help is much appreciated