wiki

Help! I'm trapped in a wiki!

Site Tools


lang:header_files

Header files

A header file is a C file that should contain the following:

  • external function declarations
  • macro definitions (preprocessor #defines)
  • structure, union, and enumeration declarations
  • typedef declarations
  • global variable declarations

Header files are generally used to save changing a lot of separate function declarations when you change something.

See also https://c-faq.com/cpp/hfiles.html

Include gaurds

To protect against multiple and circular includes, include this in your header file:

#ifndef MYHEADER_H
#define MYHEADER_H
 
// ... header content ...
 
#endif
lang/header_files.txt · Last modified: by 127.0.0.1