#include int main() { // signed char sclow, schigh; // sclow=((unsigned char)(0-1)./2)+1; // schigh=((unsigned char)(0-1)./2); // printf("low is %hhd, high is %hhd\n", sclow, schigh); //%hhu unsigned half half //%hu unsigned half int //%u unsigned int //%lu unsigned long int //%llu unsigned long long int //%hhd signed half half int //%hd signed half int //%d signed int //%ld signed long int //%lld signed long long int // Variable declarations // signed char sc = 0; unsigned char uc = 0; signed short int ssi = 0; unsigned short int usi = 0; signed int si = 0; unsigned int ui = 0; signed long int sli = 0; unsigned long int uli = 0; signed long long int slli = 0; unsigned long long int ulli = 0; // Find the max value for a signed char (half of the max of an unsigned char) // sc = ((unsigned char)(uc-1)/2) + 1; ssi = ((unsigned short int)(usi-1)/2) + 1; si = ((unsigned int)(ui-1)/2) + 1; sli = ((unsigned long int)(uli-1)/2) + 1; slli = ((unsigned long long int)(ulli-1)/2) + 1; fprintf(stdout, "TYPE: unsigned char\n-------------------\n"); fprintf(stdout, "\tsize: %hhu bytes\n", sizeof(unsigned char)); fprintf(stdout, "\t low: %hhu\n", uc); fprintf(stdout, "\thigh: %hhu\n", (uc-1)); // max of unsigned is 1 less than 0-- roll-over fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: signed char\n-------------------\n"); fprintf(stdout, "\tsize: %hhu bytes\n", sizeof(signed char)); fprintf(stdout, "\t low: %hhd\n", sc); fprintf(stdout, "\thigh: %hhd\n",(sc-1)); fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: unsigned short int\n-------------------\n"); fprintf(stdout, "\tsize: %hu bytes\n", sizeof(unsigned short int)); fprintf(stdout, "\t low: %hu\n", usi); fprintf(stdout, "\thigh: %hu\n", (usi-1)); // max of unsigned is 1 less than 0-- roll-over fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: signed short int\n-------------------\n"); fprintf(stdout, "\tsize: %hu bytes\n", sizeof(signed short int)); fprintf(stdout, "\t low: %hd\n", ssi); fprintf(stdout, "\thigh: %hd\n", (ssi-1)); fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: unsigned int\n-------------------\n"); fprintf(stdout, "\tsize: %u bytes\n", sizeof(unsigned int)); fprintf(stdout, "\t low: %u\n", ui); fprintf(stdout, "\thigh: %u\n", (ui-1)); // max of unsigned is 1 less than 0-- roll-over fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: signed int\n-------------------\n"); fprintf(stdout, "\tsize: %u bytes\n", sizeof(signed int)); fprintf(stdout, "\t low: %d\n", si); fprintf(stdout, "\thigh: %d\n", (si-1)); fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: unsigned long int\n-------------------\n"); fprintf(stdout, "\tsize: %lu bytes\n", sizeof(unsigned long int)); fprintf(stdout, "\t low: %lu\n", uli); fprintf(stdout, "\thigh: %lu\n", (uli-1)); // max of unsigned is 1 less than 0-- roll-over fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: signed long int\n-------------------\n"); fprintf(stdout, "\tsize: %lu bytes\n", sizeof(signed long int)); fprintf(stdout, "\t low: %ld\n", sli); fprintf(stdout, "\thigh: %ld\n", (sli-1)); fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: unsigned long long int\n-------------------\n"); fprintf(stdout, "\tsize: %llu bytes\n", sizeof(unsigned long long int)); fprintf(stdout, "\t low: %llu\n", ulli); fprintf(stdout, "\thigh: %llu\n", (ulli-1)); // max of unsigned is 1 less than 0-- roll-over fprintf(stdout, "-------------------\n\n"); fprintf(stdout, "TYPE: signed long long int\n-------------------\n"); fprintf(stdout, "\tsize: %llu bytes\n", sizeof(signed long long int)); fprintf(stdout, "\t low: %lld\n", slli); fprintf(stdout, "\thigh: %lld\n", (slli-1)); fprintf(stdout, "-------------------\n\n"); return(0); }