c++ - maximum value of int -


In C / C ++, to find the maximum value of the integer (according to the compiler) in Integer Is the code?

# include & lt; Limits & gt;

then

  int imin = std :: numeric_limits & lt; Int & gt; :: min (); // minimum value int imax = std :: numeric_limits & lt; Int & gt; :: max ();  

std :: numeric_limits is a template type that can be instantly used with other types:

  float fmin = Std :: numeric_limits & lt; Float & gt; :: Minute (); // minimum positive value flat fmax = std :: numeric_limits & lt; Float & gt; :: max ();  

In C:

  #include & lt; Limits.h & gt;  

then use

  int imin = INT_MIN; // minimum value int imax = INT_MAX;  

or

#include & lt; Float.h & gt; Flat FIN = FLT_MIN; // minimum positive value double dmin = DBL_MIN; // minimum positive value flat fmax = FLT_MAX; Double DMX = DBL_MX;

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -