c - Weird scanf behaviour when reading number and newline -


I think this bug of scanned now with C after 8 years.

The scanf code below will skip the leading white space characters from the second row of the input.

  int x; Four in [100]; Scanf ("% d \ n", & amp; x); please come inside);   

Input:

  1s   

x will contain 1 , but in will not be "s" "s"

whether it's standard C or just GCC behavior?

The format string will cause a white space character Scanf to consume any (and all) white space until a non-whitepress variable.

This standard appears as scanf and not limited to GCC.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -