Script started on Wed Sep 16 17:40:28 2026 macbook:Desktop> cat binary_val.c /* Specify a binary value */ #include int main (int argc, char *argv[]) { int num = 0b001100100001; printf("the binary value is %x in hex.\n", num); return 0; } macbook:Desktop> gcc binary_val.c macbook:Desktop> ./a.out the binary value is 321 in hex. macbook:Desktop> cd csc3320_Fall2026/programs/C_ch2 macbook:C_ch2> cat typedef.c /* typedef allows for user-defined types */ #include typedef short int Int16; int main (void) { Int16 a = 4; printf("the number is %d\n", a); return 0; } macbook:C_ch2> gcc typedef.c macbook:C_ch2> ./a.out the number is 4 macbook:C_ch2> cat testfrac.c #include int main() { char ch; float f, frac_part; f = 3.5; frac_part = f - (int)f; printf("frac_part = %f\n", frac_part); float quotient; int dividend = 7, divisor = 3; quotient = (float) dividend/ divisor; printf("quotient = %f\n", quotient); quotient = (float) (dividend/ divisor); printf("quotient = %f\n", quotient); return 0; } macbook:C_ch2> gcc testfrac.c macbook:C_ch2> ./a.out frac_part = 0.500000 quotient = 2.333333 quotient = 2.000000 macbook:C_ch2> cat testchar.c #include int main() { char ch; printf("Enter a char: "); scanf("%c", &ch); printf("You entered '%c' which is %d in decimal \n", ch, ch); return 0; } macbook:C_ch2> gcc testchar.c macbook:C_ch2> ./a.out Enter a char: B You entered 'B' which is 66 in decimal macbook:C_ch2> cat ~/Desktop/q6 T/F: The "char" datatype allows you to store a value with range -128 to 127 macbook:C_ch2> exit Saving session... ...saving history...truncating history files... ...completed. Deleting expired sessions...none found. Script done on Wed Sep 16 18:45:02 2026