#include <stdio.h> int main() { char a = getchar(); printf("You entered: %c", a); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

#include <stdio.h> int main() { char a = getchar(); printf("You entered: %c", a); return 0; }

In this code output I can enter multiple words and multiple character but in output it can display only my first character not display other single chatracter why??

26th Mar 2019, 4:53 PM
hetvi Ashokbhai parikh
1 Answer
+ 3
Char only store one character.. Use char array to store more characters Also use gets function to get a block of character.. Char a[30] Printf("enter a line"); gets(a); puts(a) Puts() use for print block of character.. Hope you understand.. Thanks
26th Mar 2019, 5:11 PM
Scooby
Scooby - avatar