What's a difference between putchar() & getchar () ? And give me one example of this . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's a difference between putchar() & getchar () ? And give me one example of this .

17th Oct 2020, 5:45 PM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar
3 Answers
0
Getchar takes a character input while putchar print a character output Here an example: #include <stdio.h> #include <ctype.h> int main() {    char c;    printf("Enter some character. Enter $ to exit...\n");    while (c != '
#x27;)    {       c = getchar();       putchar(c);       printf("\n");    }    return 0; } If you input: HELLO$ The output will be: H E L L O
17th Oct 2020, 5:56 PM
Davide
Davide - avatar
+ 2
Ipang no thank you 😌 Anyway I just copied and pasted from the first Google result for "getchar putchar" Here's the link, maybe can help https://fresh2refresh.com/c-programming/c-file-handling/putchar-getchar-function-c/
17th Oct 2020, 6:16 PM
Davide
Davide - avatar
+ 2
I understand. 🙏
18th Oct 2020, 4:12 AM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar