1 00:00:01,340 --> 00:00:09,260 So the next step is to iterate the list from the first link following each P next pointer until we get 2 00:00:09,260 --> 00:00:10,670 to the end of the list. 3 00:00:10,790 --> 00:00:15,020 So for each link access, the task should be executed here. 4 00:00:15,050 --> 00:00:22,820 So start by writing function that performs the execution, by printing out the description of the task 5 00:00:22,820 --> 00:00:26,750 and then returning the pointer to the next task. 6 00:00:26,780 --> 00:00:29,600 So here are just about the main function. 7 00:00:30,740 --> 00:00:34,520 We're going to add the task that we're going to add the function. 8 00:00:35,300 --> 00:00:39,500 Let's return the task here and execute this. 9 00:00:40,160 --> 00:00:43,220 This function will be named and execute task. 10 00:00:44,780 --> 00:00:49,370 A constant task on repeat task. 11 00:00:50,030 --> 00:00:51,140 So here. 12 00:00:53,280 --> 00:00:54,210 That if the. 13 00:00:54,210 --> 00:00:55,320 No, Peter. 14 00:00:55,350 --> 00:00:56,580 No, Peter. 15 00:00:57,660 --> 00:00:59,160 Equals the P task. 16 00:00:59,970 --> 00:01:02,730 Then turned the new Peter. 17 00:01:03,860 --> 00:01:08,270 See out here executing the. 18 00:01:09,330 --> 00:01:12,690 Finally, we've writing some outputs here. 19 00:01:15,730 --> 00:01:16,300 Here. 20 00:01:19,730 --> 00:01:21,440 And pit task. 21 00:01:22,620 --> 00:01:25,380 This operator here and description. 22 00:01:26,940 --> 00:01:28,620 And, of course, in line here. 23 00:01:30,460 --> 00:01:35,260 And we're going to return the task object, a task, not object task. 24 00:01:35,620 --> 00:01:37,600 The structure, as you can see here. 25 00:01:38,140 --> 00:01:41,500 Return the task P task e task. 26 00:01:42,220 --> 00:01:43,310 Um. 27 00:01:43,630 --> 00:01:45,700 P p next. 28 00:01:46,300 --> 00:01:54,130 So the parameter here is marked as constant because we will not change the task object pointed to by 29 00:01:54,130 --> 00:01:54,700 the pointer. 30 00:01:54,710 --> 00:02:00,130 So this indicates that the compiler that if the code does try to change the object, there is a new 31 00:02:00,130 --> 00:02:00,820 g here. 32 00:02:00,850 --> 00:02:07,220 The first line checks to make sure that the function is not called with the new pointer. 33 00:02:07,240 --> 00:02:09,310 So it was the following line. 34 00:02:09,370 --> 00:02:15,490 Would the reference invalid pointer and call the memory access file? 35 00:02:15,520 --> 00:02:22,420 So the last line returns the pointer to the next link, which could be new PR for the last link in the 36 00:02:22,420 --> 00:02:26,720 list so that the function can be called in loop. 37 00:02:26,770 --> 00:02:28,660 So after this function. 38 00:02:29,690 --> 00:02:32,960 We're going to add another function here. 39 00:02:32,990 --> 00:02:36,470 Void function named execute all. 40 00:02:37,250 --> 00:02:39,590 So here task. 41 00:02:41,380 --> 00:02:43,960 Ask here a task. 42 00:02:46,220 --> 00:02:47,930 Uh, p hat. 43 00:02:49,280 --> 00:02:49,760 Let's. 44 00:02:50,900 --> 00:03:00,650 Tesco signed the P shirt and while the P task is not equal to No Peter, Peter is not equal to no Peter. 45 00:03:01,590 --> 00:03:02,160 Here. 46 00:03:02,520 --> 00:03:05,310 Uh, we're gonna sign p task. 47 00:03:06,830 --> 00:03:12,500 Execute task and we're going to pass the p task itself here. 48 00:03:12,500 --> 00:03:23,210 So this course starts a beginning p head and calls the execute task on each list in the list until the 49 00:03:23,210 --> 00:03:24,970 function returns the null. 50 00:03:24,980 --> 00:03:32,090 Peter So we're going to add the call function towards the end of the main function here. 51 00:03:33,060 --> 00:03:33,740 Okay. 52 00:03:36,240 --> 00:03:43,260 Then I first exclude all function of the executive function and we're going to call the destroy. 53 00:03:44,390 --> 00:03:44,690 This. 54 00:03:44,690 --> 00:03:46,340 Troy, uh, came. 55 00:03:47,150 --> 00:03:47,660 Yeah. 56 00:03:48,350 --> 00:03:49,940 Make it up for. 57 00:03:51,540 --> 00:03:51,940 Pressure. 58 00:03:51,940 --> 00:04:01,060 We're going to call destroy list function here so we can now compile and run our code. 59 00:04:01,060 --> 00:04:01,850 But we have a slot. 60 00:04:01,930 --> 00:04:02,330 Okay. 61 00:04:02,770 --> 00:04:05,710 We can now compile and run the code here. 62 00:04:10,460 --> 00:04:12,110 The result will be like this. 63 00:04:12,110 --> 00:04:22,640 But in this here, in this lecture, we're going to add another items here in this structure and make 64 00:04:22,850 --> 00:04:26,230 it more, uh, rich with objects here. 65 00:04:26,240 --> 00:04:31,370 So in the next lecture, we're going to add the items, insert items to the struct.