#include iostream in C?

后端 未结 5 1490
半阙折子戏
半阙折子戏 2021-02-12 22:38

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

#include 

What about for C?

相关标签:
5条回答
  • 2021-02-12 23:13
    #include <stdio.h> 
    
    0 讨论(0)
  • 2021-02-12 23:21

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

    0 讨论(0)
  • 2021-02-12 23:22

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

    #include <stdio.h>
    

    It's not an analog to <iostream>. There is no analog to iostream in C -- it lacks objects and types. If you're using C++, it's the analog to <cstdio>.

    • stdio man page
    • GNU documentation on Input/Output on Streams

    See also this fantastic question and its answer,

    • 'printf' vs. 'cout' in C++
    0 讨论(0)
  • 2021-02-12 23:24
    #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.

    0 讨论(0)
  • 2021-02-12 23:32

    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>.

    0 讨论(0)
提交回复
热议问题