How to get min and max int value in C++

2 Answers

0 votes
#include <iostream>
#include <limits>
 
int main() {
 
    std::cout << std::numeric_limits<int>::min() << "\n";
    std::cout << std::numeric_limits<int>::max() << "\n";
    
    return 0;
}
 
 
 
/*
run:
 
-2147483648
2147483647
 
*/

 



answered Jan 3, 2021 by avibootz
edited Jan 3, 2021 by avibootz
0 votes
#include <iostream>
#include <limits.h>
 
int main() {
 
    std::cout << INT_MIN << "\n";
    std::cout << INT_MAX << "\n";
     
    return 0;
}
 
 
 
/*
run:
 
-2147483648
2147483647
 
*/

 



answered Jan 3, 2021 by avibootz
edited Nov 11, 2022 by avibootz

Related questions

1 answer 189 views
1 answer 141 views
1 answer 142 views
142 views asked Jun 9, 2021 by avibootz
3 answers 163 views
1 answer 195 views
195 views asked Jul 2, 2020 by avibootz
1 answer 193 views
...