Reputation: 989
How can I know what is the maximum assignable value for a variable from the the type of "unsigned long int"?
Upvotes: 11
Views: 15145
Reputation: 490338
The obvious way would be to use std::numeric_limits<unsigned long>::max();
Upvotes: 33
Reputation: 73161
Another way to find out would be:
unsigned long int i = (unsigned long int) -1;
printf("%lu\n", i);
Upvotes: 6