Why we use header file?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we use header file??

iostream or conio.h

2nd May 2021, 9:29 PM
Rao Mudasir
Rao Mudasir - avatar
3 Answers
+ 3
Header files allow us to put all the type declarations, function prototypes, enumerations ect at one place. This comes in handy especially when we have a project that span across multiple source files. Having headers make it easier to share the declarations among multiple files, otherwise one would have to write all the declerations seperately for all the source files which would be a nightmare to manage. P.S. avoid using non standard platform specific libraries as much as possible especially <conio.h> which was meant to only work with MS-DOS ( that is approx 20+ years old OS ) and doesn't have any practical application in today's date.
3rd May 2021, 12:32 AM
Arsenic
Arsenic - avatar
0
because they contain the objects and functions that we need to use, and we can create our own headers that contain our own objects.
2nd May 2021, 10:14 PM
Alfonso Farías
Alfonso Farías - avatar
- 2
Because it offers us a way to make inputs and outputs through the console in the easiest way. I don't recommend using conio.h: iostream for linux and windows <= 10. conio.h for MS-DOS windows <= 7. conio.h no is standar. Pleace using ncurses
2nd May 2021, 10:33 PM
Daniel Briceño
Daniel Briceño - avatar