What is use of header files | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is use of header files

20th Apr 2021, 10:53 AM
Astitva Tribhuwan
Astitva Tribhuwan - avatar
5 Answers
+ 7
Astitva Tribhuwan Header Files : The files that tell the compiler how to call some functionality (without knowing how the functionality actually works) are called header files. They contain the function prototypes. They also contain Data types and constants used with the libraries. We use #include to use these header files in programs.
20th Apr 2021, 10:42 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 5
Header files allow code (written by you or by other developers) to be shared and reused across different programs. The mechanics are explained here in more detail: https://www.learncpp.com/cpp-tutorial/header-files/
20th Apr 2021, 12:04 PM
Tibor Santa
Tibor Santa - avatar
+ 5
Header files are meant to solve a fundamental problem. I'm writing a library, and it contains type definitions. I define the types and functions in my library, however, people that use the library also need those types and functions. The solution is creating a header file, which contains basic type definitions and function declarations. The library `#include`s this file and implements these functions, and the program using this library `#include`s it and thus informs the compiler about the types and functions.
21st Apr 2021, 3:36 PM
SapphireBlue
SapphireBlue - avatar
0
Header and files are used to include various functionalities from the c++ library. They are included using the #include directive.
22nd Apr 2021, 9:57 AM
Ketan Kumar
Ketan Kumar - avatar
0
Header files are used in C++ so that you don't have to write the code for every single thing. It helps to reduce the complexity and number of lines of code. It also gives you the benefit of reusing the functions that are declared in header files to different Regards, Will
16th Jan 2023, 8:29 AM
william joe
william joe - avatar