In week 1 we started learning the basics.
In week 2 we discussed data types. This is also the week I decided to take on the small project of getting Linux to dual boot with windows 8 on my surface tablet….
#include<stdio.h> #include<limits.h> int main() { signed char sc; unsigned char uc; sc = 0; uc = 0; printf("\n"); printf("an unsigned char is %hhu bytes\n", sizeof(uc)); printf("lower bound is %hhu \n",uc); printf("upper bound is %hhu \n",(uc-1)); printf("a signed char is %hhd bytes\n", sizeof(sc)); printf("lower bound is %hhd \n",((unsigned char)(uc-1)/2)+1); //printf("upper bound is %hhd \n",((unsigned char)(uc-1)/2)); printf("upper bound is %hhd \n", 0xFF & 0x7F); signed short int ssi; unsigned short int usi; ssi = 0; usi = 0; printf("\n"); printf("an unsigned short int is %hu bytes\n", sizeof(usi)); printf("lower bound is %hu \n",usi); printf("upper bound is %hu \n",(usi-1)); printf("a signed short int is %hd bytes\n", sizeof(ssi)); printf("lower bound is %hd \n", ((unsigned short int)(usi-1)/2)+1); printf("upper bound is %hd \n", ((unsigned short int)(usi-1)/2)); signed int si; unsigned int ui; si = 0; ui = 0; printf("\n"); printf("an unsigned int is %u bytes\n", sizeof(ui)); printf("lower bound is %u \n",ui); printf("upper bound is %u \n",(ui-1)); printf("a signed int is %d bytes\n", sizeof(si)); printf("lower bound is %d \n",((unsigned int)(si-1)/2)+1); printf("upper bound is %d \n",((unsigned int)(si-1)/2)); signed long int sli; unsigned long int uli; sli = 0; uli = 0; printf("\n"); printf("an unsigned long int is %lu bytes \n", sizeof(uli)); printf("lower bound is %lu \n",uli); printf("upper bound is %lu \n",(uli-1)); printf("a signed long int is %ld bytes \n", sizeof(sli)); printf("lower bound is %ld \n",((unsigned long int)(uli-1)/2)+1); printf("upper bound is %ld \n",((unsigned long int)(uli-1)/2)); signed long long int slli; unsigned long long int ulli; slli = 0; ulli = 0; printf("\n"); printf("an unsigned long long int is %llu bytes \n", sizeof(ulli)); printf("lower bound is %llu \n",ulli); printf("upper bound is %llu \n",(ulli-1)); printf("a signed long long int is %lld bytes \n", sizeof(slli)); printf("lower bound is %lld \n",((unsigned long long int)(ulli-1)/2)+1); printf("upper bound is %lld \n",((unsigned long long int)(ulli-1)/2)); return(0); }