what is iostream.h in C++?



Image result for iostream

 "iostream.h is a header file. '.h' is the extension of the file. ... Header files are included in C/C++ because they have some inbuilt predefined functions and other stuff like classes, structures, etc. Even iostream means Input Output STREAM hence iostream is used for input output purposes ."

In languages like C and C++, most of the high level programming is managed with Libraries. These Libraries are "linked" at compile time. These Libraries are in Binary format. So to communicate these Binary files with our source code we need the header files. The .h extensions are of the headers files. These headers files have independent or dependent definitions and/or prototypes of specific functions to be linked from library. It's like header file knows where a certain piece of code is placed in the library.

So for example when we make a Hello world program in C, we use stdio.h as we are using printf function. But can you find the source code of printf ? It's not in the stdio.h file. It's in the C's library. and so on compilation, through stdio.h file, the compiler get the code if printf from the library. And the program works.

You don't need to use this library thing always. You can also use header files for writing the definitions like value of pi etc. And at the compile time, everything written in a header file will be taken if needed.

Post a Comment

0 Comments