In my program I'm looking at a string and I want to know if it represents a 32-bit integer.
Currently I first check if it is a digit at all using isdigit()
, then I check if it exceeds the value of 2^32 (assuming I don't care about unsigned values).
What's the best way to check that my input string contains a valid 32-bit integer?