Easy Tutorial
❮ C Macro Edom C Function Strncat ❯

C Library Function - putchar()

C Standard Library - <stdio.h>

Description

The C library function int putchar(int char) writes the character specified by the argument char (an unsigned character) to the standard output stdout.

Declaration

Here is the declaration for the putchar() function.

int putchar(int char)

Parameters

Return Value

The function returns the character written as an unsigned char cast to an int, or EOF if an error occurs.

Example

The following example demonstrates the use of the putchar() function.

#include <stdio.h>

int main ()
{
   char ch;

   for(ch = 'A' ; ch <= 'Z' ; ch++) {
      putchar(ch);
   }

   return(0);
}

Let's compile and run the above program, which will produce the following result:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

C Standard Library - <stdio.h>

❮ C Macro Edom C Function Strncat ❯