fpco / inline-c

284 stars 49 forks source link

Fix/improve "readAndSum" example #35

Closed tebello-thejane closed 8 years ago

tebello-thejane commented 9 years ago

The example code has strange behaviour. In particular, it seems to prompt 6 times while only reading the first 5 numbers. Removing the aberrant space in the scanf format specifier seems to fix it.

bitonic commented 9 years ago

Thanks!

tebello-thejane commented 9 years ago

For reference, and interest's sake, the following explains why trailing spaces in scanf are never a good idea:

http://stackoverflow.com/a/22515719/3085914