Thread: climits how to find max/min int

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    450

    climits how to find max/min int

    Sorry I looked in the FAQ, tutorials, and did a search but I don't know how to use
    <climits> to determine the max and min an integer can be. Please help!

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Code:
    cout << "max: " << INT_MAX << "\tmin: "<< INT_MIN << endl;

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Or in <limits>:
    Code:
    #include <limits>
    
    ...
    
    std::numeric_limits<int>::max();

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    thanks Thantos and DaveD

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Yeah I thought about numeric_limits but figured since he said climits I'd limit to that

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 03-10-2008, 11:57 AM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  3. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 05:20 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM