If you can't find your maximum unsigned long value, then run a test like this:
Code:
/*find the largest unsigned long int on this system -
untested for accuracy
*/
#include <stdio.h>
int main(void) {
unsigned long int n = 1000000; //does your compiler have type long long, btw?
do {
n += 10000;
if(n % 10000000 == 0) {
//gotoxy(10,10);
printf("%20lu", n);
}
}while(n > 501);
//n has overflowed the data type, so step it back until it's positive again
printf("\n\n\t Backing Up ");
do {
n -= 1;
}while(n < 1000000);
printf("\n\n\t Maximum unsigned long value is %lu", n);
printf("\n\n\t\t\t Press Enter When Ready ");
n = getchar();
return 0;
}
You'll have the answer in a few seconds. On a 16 bit compiler it's a tad over 4.29 Billion, if my program is correct.
If you don't have type unsigned long long int (for a higher range of int's), then I know of only two alternatives:
1) Remembering the number line, write your own code to handle each digit in the number.
2) Use a big number C library (Google it, I don't have a url).