The first diagram is a memory diagram for the following code: int main(...) { char *str = "Mellow"; myFunc(str); // what is str here? } void myFunc(char *s) { s++; ... } The diagram shows one stack frame box for main, one stack frame box below this for myFunc, and one box below that for the data segment, which is separate from the stack - indicated as such by a dashed line between the stack frames and the data segment. The data segment stores the read-only characters "Mellow" next to each other. Main's stack frame contains one box, for str, which has an arrow pointing to the 'M' in the data segment. myFunc's stack frame contains one box, for s, which also has an arrow pointing to the 'M' in the data segment initially. After the line s++ is executed, it is updated to point to the 'e' in the data segment. The next diagram shows the general layout of computer memory for a program. All of computer memory is modeled as a vertical rectangle. The stack is the portion of memory at the top of this rectangle, growing downwards. The heap is lower than the stack, growing upwards. The data segment is below the heap, and does not change size. The next diagram is a memory diagram for the following code: void myFunc(char *s) { s[0] = 'W'; } int main(...) { char str[6]; strcpy(str, "Hello"); myFunc(str); // what is str here? } The diagram shows one stack frame box for main and one stack frame box below this for myFunc. Main's stack frame contains an array of 6 characters, drawn as horizontally-adjacent boxes, each containing one of the characters in "Hello" plus an ending null terminator. myFunc's stack frame contains one box, for s, which has an arrow pointing to the 'M' in the character array in main's stack frame. After the line s[0] = 'W'; is executed, the 'W' is crossed out and changed to 'e' in the str array. If we also added an s++ line in myFunc, underlined in green, s would be drawn to now point to the 'e' in main's stack frame array instead, indicated by a new green arrow from s pointing to the letter 'e'. Thus, when we finish myFunc and return to main, str is now "Wello". An addition to the drawing was inserting, between the strcpy call and the myFunc call in main, reflecting the following two additional lines of code: char *p = str; myFunc(p); This replaces the previous call to myFunc, myFunc(str); With this updated code, the behavior of the program is the same. The memory diagram would be updated to now have a box in main's stack frame for p, which would have an arrow pointing to the 'W' in str. Then when myFunc is called, we make a copy of p and put it in myFunc's parameter s, so s would also point to the 'W' in str. This is the same as s's previous value before this code change. There is also a line to a call to printf("%s", str); This should not be printf("%s", *str) because *str evaluates to just the first character in the string. This passes a copy of this first character to printf to print. Therefore, printf wouldn't be able to print the whole string because it wouldn't know where the subsequent characters were in memory. The next diagram shows the memory layout for the following program: void func(int x) { x++; } int main(...) { int y = 2; func(y); // y == 2 } There is a stack frame for main, which contains one box, for y, with the number 2 inside. There is a stack frame for func below this, which contains one box, for x, with the number 2 inside. When x++ executes within func, we cross out the x = 2 box in func and replace it with 3. But y in main remains unchanged. The next diagram is for slide 89, problem 1, showing in memory what str looks like. str is an array of 7 bytes, drawn as 7 horizontally-adjacent boxes each storing one of the characters in "Hello1" and the null terminator. str refers to all 7 of these boxes together (indicated by a circle command around the array labeled with the name "str"). Finally, the last diagram shows the memory layout for slide 89, problem 3 - specifically, the following program: char arr[7]; strcpy(arr, "Hello3"); char *str = arr; str = str + 1; str[1] = 'u'; printf"%s", str); In memory, we have arr, which is an array of 7 characters, drawn as 7 horizontally-adjacent boxes storing the characters "Hello3" and the null terminator. arr refers to all 7 of these boxes together. str is drawn as a box with an arrow pointing to the 'H' in arr's characters. Then, when the line str = str + 1; is executed, that arrow is crossed out and replaced with a new one drawn to point to the 'e' in the array instead. When str[1] = 'u'; is executed, the first 'l' in arr is crossed out and replaced with the letter 'u'. Finally, when the line printf("%s", str) is executed, "eulo3" is printed, as reflected in the drawing by a green arrow from where str points to onwards in the character array. Finally, there is one additional line of code added at the end in red, which is printf("%s", arr); // Heulo3 This line would print out "Heulo3" becuase arr refers to the entire array of characters starting at the 'H'.