Total newbie question. I'm trying to restrict a user entry to a 32 bit integer. I keep getting the following warning and when I try to use the restriction it won't work:
[Warning] this decimal constant is unsigned only in ISO C90
This is my code:
Code:
if(testNum == 1 && testLetter == 0)
{
if(entry[0] == 45)
{
for(i=1; i<strlen(entry); i++)
{
total = total*10+entry[i]-'0';
}
total = total*-1;
}
else
for(i=0; i<strlen(entry); i++)
{
total = total*10+entry[i]-'0';
}
if((total > 2147483647) || (total < -2147483648) || (total+runTotal>2147483647) || (total+runTotal < -2147483648))
{
printf("Number out of range.");
}else
runTotal += total;
total = 0;
printf("\nNumber:%d\n",runTotal);
}
Yes I'm sure there are more efficient ways of doing this, but I'm just trying to learn C and get a feel for type sizes and how to work with them.