Putchar in C




 putchar-in-c

Learn C - C tutorial - Putchar in c - C examples - C programs

C - putchar() - Definition and Usage

  • In C- Programming the putchar function is similar to printf statement which will accept a character from the console file (console file is the output window where we can get the input values) or from a file, displays immediately while typing (after typing we need to press Enter key for proceeding).
C Put Char

C Syntax

   putchar(variable);

Sample coding - Put Char

#include<stdio.h>
#include<conio.h>
void main()
    {
        char x;
        clrscr();
        printf("Enter a character \n");
        x=getchar();
        printf("Given Character is %c \n");
        putchar(x);
        getch();
    }

C Code - Explanation

code-explanation-put-char
  1. In this statement we declare the variable “X” as char data type.
  2. Here Printf Statement is used for printing the given statements in the output window of C.
  3. In this statement we are getting the character value and the value will be assigned for the variable “x”.
  4. Here the putchar function is used for printing the “x” variable value in the output window.

Output :

putchar-sample-output
  1. Here in this output we get the character “a” as shown above.
  2. And we display the input character “a” using putchar function as shown in the console window.

View More Quick Examples


Related Searches to c put char

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×