Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use the strtol() or a related function to convert a string to an integer. The strtol(), strtoll(), strtoul(), and strtoull() functions convert the initial portion of a string pointed to long int, long long int, unsigned long int, and unsigned long long int representation, respectively. These functions provide more robust error handling than alternative solutions.

Non-Compliant Example 1

This non-compliant code example converts the string stored in the static array buff to a signed integer value using the atoi() function.

...