Is there a function in C that returns the maximum value of a variable like this (I will name the function \"maxvalue\" in example below)?
int a;
printf(\"%d\", m
Could easily be done using ANSI C 89:
#include
#include
int main(void) {
printf("Max value of char: %d\n", CHAR_MAX);
printf("Min value of char: %d\n", CHAR_MIN);
printf("Max value of short: %d\n", SHRT_MAX);
printf("Min value of short: %d\n", SHRT_MIN);
printf("Max value of int: %d\n", INT_MAX);
printf("Min value of int: %d\n", INT_MIN);
printf("\n\n");
return 0;
}
Notice that you can include float.h and then use:
printf("Max value of Double: %d\n", DBL_MAX);
Though, it is less recommended.
Good luck, Ron