[Solved] What The Difference between stdio.h and iostream? [duplicate]

int main ()
    // code
return 0 ;
int main ()
    // code

Which library is best to use?

What is the best and why? And when I code what is the difference in function between them?

Solution #1:

stdio.h is the header file in the C standard library. It is used for input/output

iostream is the input output class in C++

So if you’re using C++ just use #include <iostream>

Respondent: Bas

Solution #2:

First off, iostream is part of the C++ standard library, and stdio.h is part of the C standard library. While stdio.h will work in C++ it does not provide everything that iostream includes as iostream is specifically for C++.

Here is stdio.h documentation.

Here is iostream documentation.

Respondent: Nick Suwyn

Solution #3:

iostream is the C++ header for the input / output classes and objects (std::cout, std::cin…).
stdio.h is the C header for printf, scanf, … (in C++, stdio.h became cstdio)

In C++, you are not supposed to use it, use iostream instead.

Respondent: vincentp

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy