Hi All,
The following code line behaves strange...Could anyone of you help in understanding this out....
I gave an extra space " " in the scanf statment after "%s".Code:char a[10]; printf("\nEnter a string:"); scanf("%s ",a); printf("\nAccepted String is :%s",a);
The output behaves as follows:
Enter a String:abcdef
a
Accepted String is :abcdef
Although I press enter key after entering the string when prompted...it is waiting for me to give one more character. After entering an extra character in 2nd line, then the output is being displayed....
Kindly help me out...
Best Regards,
Shyamlal SVS.



LinkBack URL
About LinkBacks



I prefer fgets() if unformatted input will be accepted.