1#include <stdio.h>
2
3int main(){
4 char name[20];
5
6 printf("Enter a name : ");
7 scanf("%[^\n]%*c", &name);
8
9 printf("the name entered is: %s\n", name);
10
11return 0;
12}
1#include <stdio.h>
2
3int main(){
4 char name[20];
5
6 printf("Enter a name : ");
7 fgets(name, 20, stdin); // fgets(variable_storing_to, accepted_input_size, stdin)
8
9 printf("the name entered is: %s\n", name);
10
11return 0;