4
Talk people! Is there a function in the C language that takes the maximum/minimum value of an integer?
4
Talk people! Is there a function in the C language that takes the maximum/minimum value of an integer?
7
There is no function, but there are macros defined in the header limits.h
of standard library of C. Code example printing minimum and maximum values of an integer:
#include <stdio.h>
#include <limits.h>
int main() {
printf("Menor valor de um inteiro: %d\n", INT_MIN);
printf("Maior valor de um inteiro: %d\n", INT_MAX);
return(0);
}
See spinning in Ideone.
Thanks Master! It worked perfectly!
Browser other questions tagged c c++
You are not signed in. Login or sign up in order to post.
By "maximum value of an integer" you say the largest number that can be represented in an integer?
– Woss
I also understand that you want the lowest and highest possible values to be represented. But I agree that you could have made it a little clearer (not to be confused with the lower/higher value of two integers).
– Luiz Vieira