Script started on Wed Sep 10 17:23:25 2025 mweeks@air:c_ch2$ echo attendance code: 8080 attendance code: 8080 mweeks@air:c_ch2$ uname -m x86_64 mweeks@air:c_ch2$ cat checkTSize.c #include int main() { printf("Type char in C has %lu bytes\n", sizeof(char)); printf("Type short in C has %lu bytes\n", sizeof(short)); printf("Type int in C has %lu bytes\n", sizeof(int)); printf("Type long in C has %lu bytes\n", sizeof(long)); printf("Type long long in C has %lu bytes\n", sizeof(long long)); printf("Type float in C has %lu bytes\n", sizeof(float)); printf("Type double in C has %lu bytes\n", sizeof(double)); printf("Type long double in C has %lu bytes\n", sizeof(long double)); } mweeks@air:c_ch2$ gcc checkTSize.c mweeks@air:c_ch2$ ./a.out Type char in C has 1 bytes Type short in C has 2 bytes Type int in C has 4 bytes Type long in C has 8 bytes Type long long in C has 8 bytes Type float in C has 4 bytes Type double in C has 8 bytes Type long double in C has 16 bytes mweeks@air:c_ch2$ echo 8 bit value 8 bit value mweeks@air:c_ch2$ echo 0000 0000 0000 0000 mweeks@air:c_ch2$ echo 0000 0001 0000 0001 mweeks@air:c_ch2$ echo 0000 0010 0000 0010 mweeks@air:c_ch2$ echo 0000 0011 0000 0011 mweeks@air:c_ch2$ echo 1111 1111 1111 1111 mweeks@air:c_ch2$ echo add 1 add 1 mweeks@air:c_ch2$ echo 0000 0000 0000 0000 mweeks@air:c_ch2$ echo 256 total 256 total mweeks@air:c_ch2$ echo "2^8 = 256" 2^8 = 256 mweeks@air:c_ch2$ echo 2s complement of 1111 1111 is 1s comp, then add 1 2s complement of 1111 1111 is 1s comp, then add 1 mweeks@air:c_ch2$ echo 1111 1111 when 1s comp: 0000 0000 1111 1111 when 1s comp: 0000 0000 mweeks@air:c_ch2$ echo add 1: 0000 0001 add 1: 0000 0001 mweeks@air:c_ch2$ vi numbers.txt mweeks@air:c_ch2$ cat numbers.txt 4bit system un signed 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 -8 1001 9 -7 1010 10 -6 1011 11 -5 1100 12 -4 1101 13 -3 1110 14 -2 1111 15 -1 1110 -> 1s comp: 0001, add 1: 0010 4 bit system: range from 0..15 (unsigned) range from -8..7 (signed) mweeks@air:c_ch2$ echo ASCII stands for American Standard Code for Information Interchange ASCII stands for American Standard Code for Information Interchange mweeks@air:c_ch2$ echo "-3.14x10^0" -3.14x10^0 mweeks@air:c_ch2$ echo "-1.01010010111x2^00000000" -1.01010010111x2^00000000 mweeks@air:c_ch2$ cat testfloat3.c #include int main() { int v; v = 17; printf(" 17 Value is %d \n", v); v = 017; printf(" 017 Value is %d \n", v); v = 0x17; printf(" 0x17 Value is %d \n", v); long int v2 = 17L; printf(" 17L Value is %ld \n", v2); return 0; } mweeks@air:c_ch2$ gcc testfloat3.c mweeks@air:c_ch2$ ./a.out 17 Value is 17 017 Value is 15 0x17 Value is 23 17L Value is 17 mweeks@air:c_ch2$ exit exit Script done on Wed Sep 10 19:04:05 2025