--- title: More Arrays and Strings --- class: title # {{ page.title }} ## CSC 161 – {{ page.notes[0]['date'] | date: "%B %e, %Y" }} --- # Agenda for Today 1. Department Events 2. Upcoming Work 3. Discussion 4. Lab 5. Wrap Up --- # Department Events ## CS Table: Hallucinated References .indent[ Tuesday, February 10th at noon in JRC 224C ] You can find a complete list of token events and submit more at . --- class: section blue # Upcoming Work --- # Week 3 Lab Report **Due:** Tonight by 10:00pm See last week's class slides for the list of exercises you should submit to gradescope. Make sure you follow the coding standards we discussed two weeks ago. --- # Week 4 Quiz As usual, we'll have a quiz on Thursday. The quiz will last 10 minutes, and will focus on: 1. Pointers 2. Arrays and Strings You should expect more difficult questions than what you saw on last week's quiz. --- # Homework: Yahtzee **Due:** Thursday, February 12th by 10pm **Late Deadline:** Saturday, February 14th by 10pm ## Questions **What resources can we use if we have questions on an assignment?** - Any material posted or linked on the course website (no other online resources) - Linux `man` pages - Work you completed for labs (cite your partner) - Office hours You can discuss general C questions and program design with evening tutors and other students in the course, but the work you submit must be your own. --- class: section blue # Discussion --- # Discussion: Arrays and Strings **Items for think, pair, share:** All questions reference this code fragment: ```c char* str = "Hello world"; int arr[8] = {1, 2, 3, 4, 5, 6, 7, 8}; ``` 1. Write an expression that gets the fourth character of `str`. 2. Write an expression that gets the third element of `arr` without using the index operator (i.e. `[]`). 3. Write a statement that sets the fourth element of `arr` to `0` without using the index operator. --- # Discussion: Pointer Math What does this C function do? See if you can come up with a good explanation. ```c int f(int a[], int b) { int c = 0; for (int* d = a; d < a + b; d++) { c += *d; } return c; } ``` --- # Reading Questions Do you have any unanswered questions from the reading? --- class: section blue # Lab --- class: section blue # Wrap Up --- # Wrap Up ## Lab Work Submit the completed Tic Tac Toe game for your week 4 lab report. ## Mentor Session Attend tomorrow's mentor session from 7-9pm in this room if you want need more practice with class material. ## Reading {% include slide_reading.html %}