views:

854

answers:

7

In C++ we always put the following at the top of the program

#include <iostream>

What about for C?

+9  A: 

Well, this is called the standard I/O header. In C you have:

#include <stdio.h>
AraK
I'd include that you then need functions like `printf` and not `std::cout`.
GMan
Yes, you are right. You have all the glory of C in C++, but not the reverse :)
AraK
+5  A: 
#include <stdio.h>
danielv
+4  A: 

iostream is a C++ library for input-output. The C equivalent would be stdio.h

Fred
+5  A: 

iostreams are not supported in C, you'd need to use the C standard library functions like printf, fprintf, etc.

As mentioned elsewhere these can be found in:

#include <stdio.h>
John Weldon
+1  A: 
#include <stdio.h>

C Standard Input and Output Library (cstdio, known as stdio.h in the C language). This library uses what are called streams to operate with physical devices such as keyboards, printers, terminals or with any other type of files supported by the system. Streams are an abstraction to interact with these in an uniform way; All streams have similar properties independently of the individual characteristics of the physical media they are associated with.

Streams are handled in the cstdio library as pointers to FILE objects. A pointer to a FILE object uniquely identifies a stream, and is used as a parameter in the operations involving that stream.

There also exist three standard streams: stdin, stdout and stderr, which are automatically created and opened for all programs using the library.

Vivek
+1  A: 

In C :

#include<stdio.h> + #include<stdlib.h> to get the almost all functionality of <iostream>

For example there is system() function (for windows only) in <iostream> but not in <stdio.h>.

A: 

hello word my name is carlos "ardilla"

silvia