Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何知道“unsigned long int”类型的变量的最大可分配值是多少?
显而易见的方法是使用std::numeric_limits<unsigned long>::max();
std::numeric_limits<unsigned long>::max();
另一种查找方法是:
unsigned long int i = (unsigned long int) -1; printf("%lu\n", i);
以简单的方式:
unsigned long int i = -1; std::cout << i;