What is the Differences Between putw and putchar in C Programing Language

Putchar writes a single character to the console. Whereas putw is used to write an integer value into a file.

Putchar returns the int value of the character it wrote to the output console. Whereas putw returns zero on successful operation otherwise non-zero value is returned.

Putw requires a pointer to file but putchar doesn’t require a pointer.

Prototypes are as below:

int putw(int w,FILE *strm);

int putchar(int);

Easily remember the differences using the table below:

putw function in cputchar function in c
Used to write an integer value into a file.It writes single character to stdout.
Returns zero on successful operation otherwise non-zero value is returned.It returns the int value of the character it wrote to the console.
int putw(int w,FILE *strm);int putchar(int);