Seeking insight into a link Dave provided to someone
I need some kind of brilliant insight into the code at the following URL
The question stems from mygeti() in the following code.
Isn't the line
int mygeti(int *result)
char buff [ 13 ]; /* signed 32-bit value, extra room for '\n' and '\0' */
return fgets(buff, sizeof buff, stdin) && sscanf(buff, "%d", result) == 1;
fputs("Enter an integer: ", stdout);
} while ( !mygeti(&value) );
printf("value = %d\n", value);
A bit non-portable? What happens if the code was compiled under a 16 bit machine? Or more to the point, any type of machine who's int type is not 32 bit. Wouldn't the code break?