Start here · Essential guide
C++ Header File Example
A complete C++ header file example: a .h file with declarations, a .cpp file with definitions, a main program, and how to compile and run them.
Syntax and Functions
What .h files are for, with a worked C++ header file example.
Start here · Essential guide
A complete C++ header file example: a .h file with declarations, a .cpp file with definitions, a main program, and how to compile and run them.
A .h file is a header file that holds declarations, macros and types shared across source files. Learn what goes in one and how #include uses it.
A file header is either a comment block at the top of a source file or the metadata at the start of a binary file. Learn how it differs from a .h header.
A header file's main purpose is to share declarations across source files so each one compiles on its own. Learn why headers matter and how they are used.
write() is a POSIX system call that sends bytes from a buffer to a file descriptor. Learn its declaration, return value and a short C example.
Related topics