Determine if a C string is a valid int in C

Have a look at strtol(), it can tell you about invalid parts of the string by pointer return.

And beware of enthusiastic example code.. see the man page for comprehensive error-handling.

Leave a Comment