...
Code Block | ||
---|---|---|
| ||
long sl; if (scanf("%ld", &sl) != 1) { /* handlerhandle error */ } |
In general, do not use scanf()
to parse integers or floating-point numbers from input strings, because the input could contain numbers not representable by the argument type.
...