Standard Library Functions in C

adplus-dvertising
putchar() Function
Previous Home Next

Description

The C library function, The putchar( ) function writes the character contained in the least significant byte of char to stdout.

Declaration

Following is the declaration for putchar() function.

int putchar(int char)

Parameters

char - The int promotion of the character to be written. The value is internally converted to an unsigned char when written.

Return Value

The putchar( ) function returns the character written on success or EOF if an error occurs.

Example

#include <stdio.h>

int main ()
{
   char a;

   for(a = 'A' ; a<= 'Z' ; a++) 
   {
      putchar(a);
   }
   
   return(0);
}

Output

ABCDEFGHIJKLMNOPQRSTUVWXYZ 
Previous Home Next