char a[100],b[100],c[100];
scanf("%[^\n]",a);
printf("%s",a);
scanf("%[^\n]",b);
printf("%s",b);
The compiler seems to be reading the first read but skips the second read. Why is this happening?
char a[100],b[100],c[100];
scanf("%[^\n]",a);
printf("%s",a);
scanf("%[^\n]",b);
printf("%s",b);
The compiler seems to be reading the first read but skips the second read. Why is this happening?
Because of un handled Enter
Use fgets()
Try this :-
char a[100], b[100], c[100];
fgets(a, 100, stdin);
printf("%s", a);
fgets(b, 100, stdin);
printf("%s", b);