CJCoding With Joseph
15free / daySign inCreate account

Carleton University - SYSC 2006

The New Main Function

Assignment 2 - Spring 2025

In Assignment 1, our main() function worked with arrays of fixed size and tracked everything using indices.

But in Assignment 2, we’ve switched over to linked lists, which means we’ve had to rewrite main() to work with dynamic data structures instead.

Let’s go through the changes and the new logic step-by-step so you understand how main() now orchestrates the entire simulation.


Key Changes from Assignment 1 to Assignment 2

  • Node Storage

    • Before we were using an Array (rtable_t nodes[NODE_MAX])

    • Now we are using a Linked list (node_t* node_list)

    Invalid Node Storage

    • We did not do this before

    • Now we use another Linked List (invalid_node_t*)

    Route Storage

    • Array inside node structs

    • Linked list inside each node

    Packet Forwarding

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.