I am trying to read 2 lines of user's input. For the first sequence, if I type in nothing and just hit return key, the program the prints enter the second sequence
but not allowing the second scanf
. Basically the return just terminates both scanf
, resulting in both str1
and str2
empty.
printf("enter the first sequence: ");
scanf("%[^\n]%*c", str1);
printf("enter the second sequence: ");
scanf("%[^\n]%*c", str2);
Is there any way that I can fix this?