Carleton University - SYSC 2006
add() Breakdown
Lab 11 Linked listsIn this chapter, we’ll walk through how to complete the add() function.
//Exercise 1: Complete the implementation for inserting elements
intnode_t *add(intnode_t *head, int elem, int index) {
// YOUR IMPLEMENTATION HERE
return head;
}🧠 What does add() do?
This function inserts a new node with value elem at the specified index in the linked list.
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 25 more lessons in Carleton University - SYSC 2006.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.