Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

stdio.h — standard input and output

The stdio.h header provides types, macros, and function declarations for standard input and output in C.

Version: C23; repository compiler flag, production runtime not attested

Syntax

#include <stdio.h>

#include <stdio.h> provides, among others, the FILE type, the EOF macro, and functions such as printf, puts, fopen, and fclose. The streams stdin, stdout, and stderr represent standard input, output, and diagnostic output.

puts appends a newline; fflush(stdout) delivers buffered data to the host environment. Both functions report failure with EOF. During input, EOF can indicate end-of-file or an error; distinguish these using feof and ferror.

Examples

#include <stdio.h>

int main(void)
{
    if (puts("Hello, stdio!") == EOF) {
        return 1;
    }
    if (fflush(stdout) == EOF) {
        return 1;
    }
    return 0;
}

Result

Hello, stdio!

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources