header file declaration

are header files declared in the .h or .cpp file?

I searched and read that about headers, and looked at sample code. What I read said to declare headers in the header file but in-practice it looks like they are declared at the top of both the header and source file. My compiler certainly wants them in the source file. Logically, it seems that declaring in the header file will satisfy the source file.

What are the rules and best practice?
Headers can be included in both header files and source files. Include all the headers that is needed for the file to compile.

Topic archived. No new replies allowed.