I wrote a function in C that converts a string to an integer and returns the integer. When I call the function I also want it to let me know if the string is not a valid num
The os-style global errno variable is also popular. Use errno.h.
errno.h
If errno is non-zero, something went wrong.
Here's a man page reference for errno.