A basic script that’s too simple to post it on Github.
#include <limits.h> // for the integers macros
#include <inttypes.h> // for fixed width numbersint main(void)
// C has four basic type: char, int, float and double.
// The four modifiers are: signed, unsigned, short and long.
// The macro for the lower limit of unsigned type don’t exist since it’s 0
// The return type of sizeof is size_t that can be printed with %lu
// All the char sizes are CHAR_BIT bits.
printf(“char %luB %d to %d \n”, sizeof(char), CHAR_MIN, CHAR_MAX); // %c for printing the character
printf(“signed char %luB %hhi to %hhi \n”, sizeof(signed char), SCHAR_MIN, SCHAR_MAX);
printf(“unsigned char %luB %hhu to %hhu \n\n”, sizeof(unsigned char), 0, UCHAR_MAX);
printf(“short int %luB %hi to %hi \n”, sizeof(short int), SHRT_MIN, SHRT_MAX);
printf(“unsigned short int %luB %hu to %hu \n”, sizeof(unsigned short int), 0, USHRT_MAX);
printf(“int %luB %d to %d \n”, sizeof(int), INT_MIN, INT_MAX); // %d or %i
printf(“unsigned int %luB %u to %u \n\n”, sizeof(unsigned int), 0, UINT_MAX);
printf(“long %luB %ld to %ld \n”, sizeof(long), LONG_MIN, LONG_MAX); // %ld or %li
printf(“unsigned long %luB %d to %lu \n”, sizeof(unsigned long), 0, ULONG_MAX); // 0 is int
printf(“long long %luB %lld to %lld \n”, sizeof(long int), LLONG_MIN, LLONG_MAX);
printf(“unsigned long long %luB %d to %llu \n\n”, sizeof(unsigned long long), 0, ULLONG_MAX); // 0 is int// For the floating type there are various formats for printing: %f %g %e %a.
// %F %G %E %A will produce the special values (INF, NAN, E) in uppercase.
printf(“float %luB %e to %e \n”, sizeof(float), FLT_TRUE_MIN, FLT_MAX);
printf(“double %luB %le to %le \n”, sizeof(double), DBL_TRUE_MIN, DBL_MAX);
printf(“long double %luB %Le to %Le \n\n”, sizeof(long double), LDBL_TRUE_MIN, LDBL_MAX);printf(“int16_t %luB %d to %d \n”, sizeof(int16_t), INT16_MIN, INT16_MAX);
// fixed width integer types have various flavours
// see https://en.wikipedia.org/wiki/Limits.h#Fixed-width_integer_types