class: title # Review ## CSC 161 – March 3, 2026 --- # Agenda for Today 1. Department Events 2. Upcoming Work 3. Review 4. Wrap Up --- # Department Events ## CS Table: LLM-Mediated Computing .indent[ Tuesday, March 3rd at noon in JRC 224C ]
## CS Poster Sessions .indent[ Wednesday, April 8th and Thursday, April 9th, 4:15pm–5:45pm Register to present at
] You can find a complete list of token events and submit more at
. --- class: section blue # Upcoming Work --- # Exam 1 In class on Thursday, March 5th ## Policies - You will have the full 110min class period to take the exam. - I will provide scratch paper and a scientific calculator. - You can bring a two-sided 8.5x11" sheet of *hand written* notes. - You may not use any other resources on the exam. --- # Exam 1 Topics The exam will cover material through week six. Topics may include: .left-col[ - Variables and Types - C Statements and Expressions - Loops - Conditionals - Functions - Pointers - Arrays - Strings ] .right-col[ - Structs - Enums - Unsigned Binary Integers - Two's Complement Binary Integers - Floating Point Representation - Multifile Projects - Makefiles - Debugging and Testing ] --- class: section blue # Review --- # Review: Checking for Palindromes Complete the function below: ```c bool is_palindrome(char* message) { int length = strlen(message); ... ``` --- # Review: Name That Function Suggest a better name for the function, parameters, and variable in the code below, and then explain how the function works. ```c int w(char* x, char* y) { int z = 0; while (x[z] == y[z] && x[z] != '\0') { z++; } return x[z] - y[z]; } ``` --- # Review: Multiplying Complex Numbers The `struct complex` type represents a complex number: ```c struct complex { float real; float imaginary; }; ``` Write functions `complex_add` and `complex_multiply` that add and multiply complex numbers. ```c struct complex complex_add(struct complex a, struct complex b); struct complex complex_multiply(struct complex a, struct complex b); ``` --- # Review: Number Representation The signed 8-bit integer variable `x` is defined as follows: ```c int8_t x = 0b11111100; ``` *Note: the `int8_t` type is guaranteed to be a signed 8-bit integer, which usually means it is a `char`.* When we assign an integer to a `float` (as in the following code fragment), C will implicitly convert the integer to an equivalent floating point value. The two variables will have very different binary representations even though they represent the same number. ```c float y = x; ``` ***What is the binary representation of `y`?*** --- # Review: Makefiles and Multifile Projects .left-col[ Consider a program with three `.c` files and two `.h` files: - `x.c` includes `y.h` and `z.h` - `y.c` includes `y.h` - `z.c` includes `z.h` We can compile the whole program with this command: ```shell $ clang -o program x.c y.c z.c ``` ] .right-col[ ## Problems 1. Write a single `Makefile` rule that runs the command above any time the program needs to be updated. 2. Rewrite the compilation command above as a series of commands to perform *separate compilation*. 3. Write a `Makefile` that can perform the separate compilation steps for you automatically. ] --- class: section blue # Wrap Up --- # Wrap Up ## Mentor Session Want some extra practice before the exam? Attend tomorrow's mentor session from 7-9pm. ## Exam Note Sheet Don't forget, you can bring a two-sided 8.5"x11" sheet of hand-written notes for the exam on Thursday.