I want to read a int from stdin but I want to validate if the user exceeds the int max value. How can I do it?
int n; scanf(\"%d\", &n);
Read it into a string and check the length, then call either atol() or sscanf() on the string to convert it into a int.
atol()
sscanf()