C Language: putc function(Write Character to File)

In the C Programming Language, the putc function writes a character to the stream pointed to by stream.


The syntax for the putc function in the C Language is:

int putc(int c, FILE *stream);

Parameters or Arguments


The character to write to the stream.


The stream to write to.


The putc function returns the character written. If an error occurs writing to the stream, the putc function will set the stream's error indicator and return EOF.

Required Header

In the C Language, the required header for the putc function is:

#include <stdio.h>

Applies To

In the C Language, the putc function can be used in the following versions:

  • ANSI/ISO 9899-1990

stdio.h Functions