Is there anything similar to Java's Integer.MIN_VALUE in C, which gives the smallest possible value of a signed integer, or do I just have to hard code the value myself?
C - Get smallest possible signed integer
7.6k Views Asked by 0x56794E At
3
There are 3 best solutions below
0

You will find INT_MIN
and INT_MAX
in <limits.h>
(for plain int). Indeed, the header defines the limits for all the integer types: signed char, short, plain int, long and long long, with the prefixes SCHAR_
, SHORT_
, INT_
, LONG_
and LLONG_
. All these are required to exist per ISO C99 and C11 (and, except for long long
, in C89).
0

In header limits.h
you will get minimum and maximum value of data types.
For integer you can use -
INT_MAX //max value for signed integer
INT_MIN //min value for signed integer
You can use
limits.h
http://en.cppreference.com/w/c/types/limitsI think this is what you're looking for:
INT_MIN = minimum value for an int