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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -