C Programming Tutorial – 66: The getchar() and putchar() Functions

In this tutorial we’ll see how we can use the getchar() function to receive single character input and how we can display characters using the putchar() function.


Rajnikanth Rajni says:

thank you dude.

Patrick Roosenburg says:

putchar handzup

Blaze Kazama says:

Thanks! In the first second of your video, I understood how they are used by how you arranged the program. I cannot express how terribly they explained it at my college.. 

Gudu Kasa says:

 char ch;
 printf(“Enter a character:”);
 ch = getchar();
 printf(“The character entered is:”);


Here is the code

takeshi gomez says:

Thanks a lot!!

Oleksandr Mapatelian says:

Hey! What service do you use to write the code and display the output? Thanks!

Supreet M says:

Is this the syntax for putchar() and get char()

Limon Sheikh says:

really very bad

Anna Georgieva says:

Your tutorials are amazing, I understand everything because of you, bless u,

Yarden Modan says:


Michael Knox says:

As always, spot on!

Prakash Subedi says:


Bill Stanard says:

Very nice! Thank you. What IDE are you using? I am having a problem running this short example in Eclipse on a Windows 7 machine.


Cesare Venzo says:

your english is very bad

pedro nobrega says:

hello man can you help me ?
i know gow to PRINT ancii chars on screen..
what i need to know its how to execute those commands ..
(example: i want to extract ancii chars + concaternate then + execute then)

char a = 21;
char b = 32;
char command = putchar(a);putchar(b);
int system(char command);


h Kamboj says:

if i use a loop….
for(int i =0; (ch= getchar()) !=EOF;i++)
ch = getchar();
then when will the loop terminate

Wahid Hamidy says:

Thanks buddy, it helps a lot

Joel Jones says:

Where is include

Aleksandar Ivanov says:

Why would i use getchar and putchar ? Like i understand what they are doing but why would i use them and i have printf scanf etc.

jack smack says:

I been trying to use visual studio to run this code but sadly it doesn’t work. What program are you using?

Fahad Anwar says:

We can do the same using scanf() and printf(). So is there a difference between their usage based on your example?

Advik Singh says:

is there a way by which we can take input without pressing ENTER Key
i.e., Are you sure to quit? y/n where pressing y close application and pressing n go to another statement in the program.
If anybody knows it please reply to my comment.

11swallowedinthesea says:


 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!