CJCoding With Joseph
15free / daySign inCreate account

add() Breakdown

Lab 11 Linked lists

In 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.

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
  • Mock exams marked by hand, with feedback
  • 3,000 AI tutor tokens / month
  • Personal SQL database (3 MB)
  • Progress tracking

Cancel anytime.