What is the fundamental difference between source and header files in C?

Viewed 49285

I don't quite understand how things should be separated in C's source and header files. I often see many projects with two sets of files with the same name (an extension denotes a source and another donates a header file).

So far, from this lack of understanding, when I've written libraries, I've chucked all the class and class method code into one file, with indecision as to choosing the file extension.

What should be in headers and what should be in the source files? How do I implement this separation?

4 Answers
Related