So the next step is to iterate the list from the first link following each P next pointer until we get
to the end of the list.
So for each link access, the task should be executed here.
So start by writing function that performs the execution, by printing out the description of the task
and then returning the pointer to the next task.
So here are just about the main function.
We're going to add the task that we're going to add the function.
Let's return the task here and execute this.
This function will be named and execute task.
A constant task on repeat task.
So here.
That if the.
No, Peter.
Equals the P task.
Then turned the new Peter.
See out here executing the.
Finally, we've writing some outputs here.
Here.
And pit task.
This operator here and description.
And, of course, in line here.
And we're going to return the task object, a task, not object task.
The structure, as you can see here.
Return the task P task e task.
Um.
P p next.
So the parameter here is marked as constant because we will not change the task object pointed to by
the pointer.
So this indicates that the compiler that if the code does try to change the object, there is a new
g here.
The first line checks to make sure that the function is not called with the new pointer.
So it was the following line.
Would the reference invalid pointer and call the memory access file?
So the last line returns the pointer to the next link, which could be new PR for the last link in the
list so that the function can be called in loop.
So after this function.
We're going to add another function here.
Void function named execute all.
So here task.
Ask here a task.
Uh, p hat.
Let's.
Tesco signed the P shirt and while the P task is not equal to No Peter, Peter is not equal to no Peter.
Here.
Uh, we're gonna sign p task.
Execute task and we're going to pass the p task itself here.
So this course starts a beginning p head and calls the execute task on each list in the list until the
function returns the null.
Peter So we're going to add the call function towards the end of the main function here.
Okay.
Then I first exclude all function of the executive function and we're going to call the destroy.
This.
Troy, uh, came.
Yeah.
Make it up for.
Pressure.
We're going to call destroy list function here so we can now compile and run our code.
But we have a slot.
Okay.
We can now compile and run the code here.
The result will be like this.
But in this here, in this lecture, we're going to add another items here in this structure and make
it more, uh, rich with objects here.
So in the next lecture, we're going to add the items, insert items to the struct.