C putc()

The putc() function writes the character contained in least significant byte of ch to the output stream pointed to by stream. Because the character arguments are elevated to integer at the time of call, you can use the character values as the arguments to putc(). putc() is often implemented as a macro.

putc() Syntax

int putc(int ch, FILE *stream);

The putc() function returns the character written if successful, otherwise EOF if an error occurs.

putc() Example

Following loop writes the characters in the string str to the stream specified by fp. The null terminator is not written :

for(; *str; str++)
	putc(*str, fp);

C Online Test

« Previous Function Next Function »

Like/Share Us on Facebook 😋