Week 10 Tutorial Questions
Reminder: Assignment 2 released
If you have any questions about Assignment 2, feel free to ask them now.
Part 2: Diagramming Linked Lists (10 mins)
In this activity we will run through the following instructions and build a diagram.
malloc memory for a new node called node1
node1 data = 3
node1 next = NULL
make the head pointer points to node1
malloc memory for a new node called node2
node2 data = 9
node2 next = NULL
add node2 to the tail of the list, making node1 next point to node2
malloc memory for a new node called node3
node3 data = 5
node3 next = NULL
add node3 to the head of the list, making node3 next point to the current head of the list
make the head point to node3
Part 3: Malloc and Strings
Give an example of allocating memory for a string of size 20 and then store "Hello" in that.
Part 4: Memory leak
What is a memory leak?
What does dcc --leakcheck
do?
Voice of the Student
✨ Help Us Improve Your Learning Experience ✨
Your feedback helps us understand what’s working well and what might need improvement.
This quick, anonymous check-in has just two questions and takes less than a minute to complete.
Please answer honestly — your input makes a real difference.