문제

How can I know what is the maximum assignable value for a variable from the the type of "unsigned long int"?

도움이 되었습니까?

해결책

The obvious way would be to use std::numeric_limits<unsigned long>::max();

다른 팁

Another way to find out would be:

unsigned long int i = (unsigned long int) -1;
printf("%lu\n", i);

In simple way:

unsigned long int i = -1;
std::cout << i;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top