By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

Just need an example on how to use INT_MIN and INT_MAX

P: 64
I just need a example on how to use them. I know you have to #include <limits.h>.
I been trying to find online, but all they give me is a range. Thanks in advance.
Feb 21 '07 #1
Share this Question
Share on Google+
3 Replies


RedSon
Expert 5K+
P: 5,000
Since INT_MAX and INT_MIN should be declared statically you can access it by doing Limits::INT_MAX. That is unless they are included in another thing that is not called Limits. It would be something like <SomethingName>::Limits or you could just try the :: scope resolution operator to see if it recognizes it then.
Feb 21 '07 #2

P: 64
Since INT_MAX and INT_MIN should be declared statically you can access it by doing Limits::INT_MAX. That is unless they are included in another thing that is not called Limits. It would be something like <SomethingName>::Limits or you could just try the :: scope resolution operator to see if it recognizes it then.
Sorry, I'm still sorta confused. Anyway you could do me in c++ code? Thanks in advance.
Feb 21 '07 #3

P: 64
Let me try to explain a little more. I been trying to use it in a loop. Where it will scan all the numbers that come in and see which one is the highest. I tried things like if
Expand|Select|Wrap|Line Numbers
  1.     printf("Enter your numbers: <EOF> to stop[CTRL Z].\n");
  2.     scanRes = scanf("%d", &x);
  3.     while ( scanRes != EOF)
  4.     {
  5.        sum += x;
  6.            if(x>=largest)
  7.             largest = x;
  8.  
no luck however.
Feb 22 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.