To minimize the code you already have, you can use the function %n sscanf:
int chars_read;
r[1] = sscanf(c, "%d%n", &r[0], &chars_read);
If it is chars_readless than the length of the string, then it sscanfdid not consume all the characters, so the string did not consist entirely of one whole.
Linux scanf , , 1 , . sscanf, :
switch (r[1]) {
case EOF:
break;
case 0:
break;
case 1:
case 2:
if (c[chars_read] == '\0')
r[1] = 1;
else
r[1] = 0;
break;
default:
assert(FALSE);
}