WEBVTT 1 00:00:31.380 --> 00:00:34.920 Wagstaff, Kiri L: accorded for the benefit of anyone who is not able to log in. 2 00:00:35.970 --> 00:00:46.500 Wagstaff, Kiri L: So keep that in mind. And we will be doing a big experiment here. This is the making personal history for me. And this is the largest zoom meeting. I've ever been in. 3 00:00:46.830 --> 00:00:58.890 Wagstaff, Kiri L: We have a lot of people logged in. So we want to keep that pretty orderly everybody's muted. But you are so welcome to ask a question at any time. So all you do to do that is click the raise hand. 4 00:00:59.490 --> 00:01:04.140 Wagstaff, Kiri L: Button and that will show up for me and then I can give you the floor. So you can ask your question. 5 00:01:05.520 --> 00:01:06.000 Wagstaff, Kiri L: So, 6 00:01:07.470 --> 00:01:20.850 Wagstaff, Kiri L: Let's see, what else, basically, I know that you may have a lot of uncertainty. Right now, we have had a lot of craziness going on and you may be nervous about this class, and many other things going on in your life and I completely understand that. 7 00:01:21.300 --> 00:01:31.350 Wagstaff, Kiri L: So I want you to know that I am doing my best to try to keep things going. And to adapt to the situation as it evolves and to share that information with you so 8 00:01:31.860 --> 00:01:39.060 Wagstaff, Kiri L: Know that I have your best interests at heart. This is we're going to do what we can to finish out this term and then resume with spring. 9 00:01:39.780 --> 00:01:48.690 Wagstaff, Kiri L: But be aware, there may be some bumps and some difficulties and some changing requirements as we figure this out because we're going into uncharted territory. 10 00:01:50.100 --> 00:01:58.080 Wagstaff, Kiri L: Now for today. Our main goal is to be able to prepare for the final exam, but I do have a couple of the things I wanted to address first 11 00:01:58.560 --> 00:02:13.290 Wagstaff, Kiri L: So as you will have seen through email. We've converted the proficiency demo, just to a regular lab. So you have or will receive depending on whether you've done your lab so far, a score of 01 or 10 on that lab and 12 00:02:14.700 --> 00:02:19.290 Wagstaff, Kiri L: Please don't graffiti the screen while we're doing this just so it's not confusing for the other students. 13 00:02:21.240 --> 00:02:29.670 Wagstaff, Kiri L: If you do not get a 10, which is what we were using to indicate a pass on that your coarse grained will not be reduced to the 72% 14 00:02:30.450 --> 00:02:48.630 Wagstaff, Kiri L: Maximum which was what proficiency demo was originally going to do right so that's the great news is stakes are lower here. It's just a regular lab. You just need to complete it. If you don't pass the demo and you get like a one or a zero indicating that you weren't there at all. 15 00:02:49.680 --> 00:02:52.260 Wagstaff, Kiri L: Then it would just act as a regular lab. 16 00:02:52.380 --> 00:02:56.340 Wagstaff, Kiri L: Which works out to a maximum of 1% of your final grade. 17 00:02:57.720 --> 00:03:06.690 Wagstaff, Kiri L: We will not be having an in person makeup proficiency demo be, you know, given University requirements at this time and 18 00:03:07.140 --> 00:03:14.550 Wagstaff, Kiri L: basic common sense. It seems like not a good idea to have any more in person gatherings than we need. So I just want you to be informed about that. 19 00:03:15.450 --> 00:03:23.370 Wagstaff, Kiri L: Anybody have a question about the proficiency demo slash lab 10 you'd like to ask now just raise your hand. Okay. We do have one here. So Dylan. Go ahead. 20 00:03:24.750 --> 00:03:34.290 Dylan Karambut: Yeah, so basically proficiency demo is my failed the prophecy to demo, if not fell VCs will just be one itself, right, just to clarify, 21 00:03:35.250 --> 00:03:37.470 Wagstaff, Kiri L: Yes. That's exactly right. We 22 00:03:38.490 --> 00:03:39.510 Wagstaff, Kiri L: It does not impact. 23 00:03:40.860 --> 00:03:44.640 Wagstaff, Kiri L: Clothing as a lab scored with a every other Lab does. 24 00:03:47.580 --> 00:03:48.780 Dylan Karambut: So perfect. Thank you. 25 00:03:49.050 --> 00:03:49.620 Wagstaff, Kiri L: I'm sure other 26 00:03:50.340 --> 00:03:52.440 Wagstaff, Kiri L: That same question. So thank you for asking that. 27 00:03:53.220 --> 00:03:56.520 Wagstaff, Kiri L: Anything else about the person proficiency done well, you want to ask at this time. 28 00:04:00.210 --> 00:04:04.710 Wagstaff, Kiri L: Okay. Oh, we have one more. Go ahead. Let's see, where's my mouse. 29 00:04:06.660 --> 00:04:07.470 Wagstaff, Kiri L: Go ahead, Casey. 30 00:04:08.970 --> 00:04:12.810 Casey: I was just wondering why you made it less 31 00:04:15.960 --> 00:04:17.760 Wagstaff, Kiri L: Why we've adopted it this way. 32 00:04:18.570 --> 00:04:20.070 Wagstaff, Kiri L: Yeah. Yes. 33 00:04:20.550 --> 00:04:31.110 Wagstaff, Kiri L: Partly because we don't have the ability to do make ups and normally we would offer that option. So this is the US being generous option here. 34 00:04:39.450 --> 00:04:40.020 Wagstaff, Kiri L: All right. 35 00:04:41.460 --> 00:04:57.300 Wagstaff, Kiri L: Then reminder that we do have a survey on canvas that you can give your opinion of the course materials and how useful. They've been for you, which is very, very helpful for our for us for the course and that survey is open until midnight tonight on canvas. 36 00:04:58.680 --> 00:05:02.340 Wagstaff, Kiri L: And I just realized my video was not on so you couldn't see me could you 37 00:05:03.930 --> 00:05:05.400 Wagstaff, Kiri L: Are you able to see me now. 38 00:05:07.770 --> 00:05:13.380 Wagstaff, Kiri L: Yes. Okay, great. It's not showing me so I have no idea what you're saying but hi everybody. 39 00:05:17.580 --> 00:05:21.150 Wagstaff, Kiri L: For the final exam itself. This will be take place that I 40 00:05:22.800 --> 00:05:32.820 Wagstaff, Kiri L: Take place at our regular time from six to 7:50pm it just will not take place in person. It will all be on canvas. 41 00:05:35.250 --> 00:05:45.120 Wagstaff, Kiri L: It will have the same format. And as we've been expecting, true, false, and multiple choice, no short answer. The exam duration is an hour and 15 minutes long, so 42 00:05:45.840 --> 00:05:47.850 Wagstaff, Kiri L: Same duration that you're expecting as well. 43 00:05:48.420 --> 00:05:59.190 Wagstaff, Kiri L: And I'm giving a little extra time at the end for the final submission, just in case you try to, you try to start the exam at six. But there's a problem. You have to reboot your computer or something. 44 00:05:59.820 --> 00:06:11.760 Wagstaff, Kiri L: And you end up starting a little bit later 605 or 610, you can still have an hour and 15 minutes so it won't, it won't shut things down until 8:15pm on March 16 45 00:06:12.420 --> 00:06:21.000 Wagstaff, Kiri L: Just in case you were delayed starting. But if you are still working on the exam at that point canvas will auto submit whatever you've done so far at 815 46 00:06:21.390 --> 00:06:31.920 Wagstaff, Kiri L: So just keep that in mind. It's really good to get started right at six. If you can, but don't stress out if you have a few minutes delay, you'll still get the full duration of time available for you. 47 00:06:32.850 --> 00:06:41.250 Wagstaff, Kiri L: And I will also I'm adding some virtual office hours today through zoom right after this class. It's a different link so 48 00:06:41.730 --> 00:06:49.260 Wagstaff, Kiri L: You will have seen that in your, your email as well, but feel free to join there. That one is set up so that there is a waiting room. So when you join 49 00:06:50.100 --> 00:06:58.650 Wagstaff, Kiri L: You'll be in the waiting room, and then I'll have you come in one by one. So we can simulate what we would normally do with office hours and we will give that a try and see how that goes. 50 00:07:00.960 --> 00:07:02.520 Wagstaff, Kiri L: Alright, feel free. 51 00:07:04.050 --> 00:07:06.480 Wagstaff, Kiri L: To raise your hand if you have a question about the final exam. 52 00:07:07.590 --> 00:07:08.850 Wagstaff, Kiri L: Structure that I just shared 53 00:07:12.600 --> 00:07:13.050 Wagstaff, Kiri L: All right. 54 00:07:15.450 --> 00:07:16.350 Wagstaff, Kiri L: Liam. Go ahead. 55 00:07:18.420 --> 00:07:20.880 Liam: Hi, um, I was. Wait, is this working 56 00:07:21.360 --> 00:07:22.140 Wagstaff, Kiri L: Yes, I can hear you. 57 00:07:22.500 --> 00:07:38.010 Liam: Terrific. Um, I was wondering, since the exam is going to be moved online. Is it going to be like redone since you can't stop us from using notes or something. Will the questions on the exam. Be harder as a result of it being online. 58 00:07:39.210 --> 00:07:49.740 Wagstaff, Kiri L: Think so. My view of that is at this time. The exam is so close that we don't really want to just change the whole format. I know a lot of you've already been studying these questions that we've that I've provided 59 00:07:50.400 --> 00:07:53.130 Wagstaff, Kiri L: So keep it the same as much as possible. 60 00:07:53.790 --> 00:08:10.530 Wagstaff, Kiri L: I am trusting all of you to treat this very seriously to approach it with full academic integrity to not use your notes to not use your friends to not use the internet, just like you would if it were on paper and I know that there will be temptation, perhaps 61 00:08:11.550 --> 00:08:17.820 Wagstaff, Kiri L: And there's I can't police that is not proctored I'm relying on you to do the right thing here. 62 00:08:18.390 --> 00:08:19.890 Liam: So it's just like a trust than 63 00:08:20.490 --> 00:08:29.310 Wagstaff, Kiri L: It is in any setting. It is a trust thing that I trust, you'll follow academic integrity I but I'll let you know that is my expectation for this exam. 64 00:08:29.520 --> 00:08:30.720 Liam: Fantastic. Thank you so much. 65 00:08:30.990 --> 00:08:32.790 Wagstaff, Kiri L: Yep, thanks for asking. 66 00:08:35.820 --> 00:08:36.480 Wagstaff, Kiri L: Alright. 67 00:08:38.610 --> 00:08:42.120 Wagstaff, Kiri L: I can't tell. Who is he, Why n g, but please go ahead 68 00:08:46.740 --> 00:08:47.790 Wagstaff, Kiri L: Do you have a question. 69 00:08:48.390 --> 00:08:51.330 huyng: Actually, nevermind. Yeah, that was the answer my questions. 70 00:08:53.520 --> 00:08:56.670 Wagstaff, Kiri L: Okay, we, um, did you still have a question or is your hands just up 71 00:09:00.150 --> 00:09:01.800 Liam: I know I just felt so alone. Sorry. 72 00:09:02.190 --> 00:09:06.510 Wagstaff, Kiri L: All right, no problem. Okay, any other final exam structure questions. 73 00:09:09.240 --> 00:09:09.660 Wagstaff, Kiri L: All right. 74 00:09:11.730 --> 00:09:22.980 Wagstaff, Kiri L: Before we jump into that I did want to give you OPPORTUNITY SINCE of course assignment six is also do on Saturday. If you have questions about that. I'm also happy to talk about this in office hours. 75 00:09:26.940 --> 00:09:30.300 Wagstaff, Kiri L: Raise your hand if you have a quick question about assignment six 76 00:09:31.650 --> 00:09:39.450 Wagstaff, Kiri L: And brandy. If you ask a question in the chat. You certainly can. I'm scrolling by really fast. So if I don't see it, then feel free to react or raise your hand. 77 00:09:40.530 --> 00:09:42.570 Wagstaff, Kiri L: But you can also type a question if you prefer. 78 00:09:50.730 --> 00:09:57.450 Wagstaff, Kiri L: And please be aware, everybody those comments are typing in the to the chat window. Everyone can see it. So let's let's treat each other with respect 79 00:10:05.850 --> 00:10:20.910 Wagstaff, Kiri L: Brandi. I see your question about if your lowest grade was a 74 and then is it worth doing assignment six for the extra six points. Yes, absolutely. You would earn up to 80 points for Simon six. So that would, if it's higher than your 74 it would take the place of it. 80 00:10:24.270 --> 00:10:24.750 Wagstaff, Kiri L: Great. 81 00:10:26.550 --> 00:10:28.500 Wagstaff, Kiri L: Okay, we do have a question here. So, 82 00:10:29.610 --> 00:10:31.440 Wagstaff, Kiri L: You way I've unmuted you go ahead 83 00:10:32.280 --> 00:10:37.530 Koh, Yu Wei: I'm not yet received my group for Simon five. So when would that be, oh, and 84 00:10:39.240 --> 00:10:44.100 Wagstaff, Kiri L: Most, most of those have been graded, but not all, our goal is to have them graded by the 85 00:10:44.160 --> 00:10:46.710 Wagstaff, Kiri L: End of Sunday, but hopefully before then. 86 00:10:47.130 --> 00:10:50.370 Wagstaff, Kiri L: So yeah, thank you for asking about that as well. 87 00:10:50.640 --> 00:10:55.470 Koh, Yu Wei: Because then I will know if I get less than 80 points to submit assignment six. I'm not 88 00:10:56.280 --> 00:11:04.860 Wagstaff, Kiri L: I, I completely understand that if you think you might be at risk. I would go ahead and just do the assignment, given that it's due tomorrow, so I don't want you to be having to work at the last minute. 89 00:11:05.580 --> 00:11:06.120 Koh, Yu Wei: All right. Thank you. 90 00:11:10.410 --> 00:11:10.860 Okay. 91 00:11:13.320 --> 00:11:20.010 Wagstaff, Kiri L: There's a question about the final exam prep questions. Those are on the course website. So if you scroll there you can pick them up. 92 00:11:23.910 --> 00:11:34.920 Wagstaff, Kiri L: Let's see if you have a assignment five really great question. Reach out to the team who graded your assignment and CC me on that message. So I know what's going on there. 93 00:11:38.400 --> 00:11:43.890 Wagstaff, Kiri L: Question from Alvin about if you got, for example, a 126 out of 121 29 94 00:11:46.770 --> 00:11:48.990 Wagstaff, Kiri L: Will the six extra credit you got on the first one. 95 00:11:50.070 --> 00:11:53.520 Wagstaff, Kiri L: Yes. Keep in mind all of your assignment points go into a big pool. 96 00:11:54.570 --> 00:12:02.040 Wagstaff, Kiri L: So if you exceeded the total for one assignment, then those points kind of spill over and WOULD MAKE UP FOR ANY deficit on another assignment. 97 00:12:03.810 --> 00:12:11.010 Wagstaff, Kiri L: I know it's a little confusing, but it's actually a good, a good system so that your extra credit has a nice impact on the rest of your assignments as well. 98 00:12:14.490 --> 00:12:21.630 Wagstaff, Kiri L: Alrighty, so for our final exam review. You might remember when we did a review for a midterm to I gave you a little menu. 99 00:12:22.500 --> 00:12:31.530 Wagstaff, Kiri L: This is that same menu with the addition that we also have struts and recursion, which are the new material and 100 00:12:32.160 --> 00:12:47.670 Wagstaff, Kiri L: So these are a lot of things we could talk about. But I think it makes sense to focus at least first on the strokes and recursion, because that's the newer material. So I'm going to pull that up and we can go through that and then with remaining time we can select any of these 101 00:12:48.840 --> 00:12:54.420 Wagstaff, Kiri L: Topics that you want to actually cover so hang on, while I add sharing these questions. 102 00:13:04.890 --> 00:13:06.300 Wagstaff, Kiri L: Alright, um, 103 00:13:07.620 --> 00:13:17.250 Wagstaff, Kiri L: Can someone give me a B or Thumbs up if you can see the pdf of the practice final exam question. All right, we got a bunch of those. Okay, just, yeah, that's a lot. 104 00:13:20.520 --> 00:13:26.910 Wagstaff, Kiri L: Also see a question. Will there be extra points on the final. Yes, there will be some extra credit just like we had for midterms wanted to 105 00:13:27.630 --> 00:13:40.380 Wagstaff, Kiri L: If you want to do it. Okay, so here's what I had put up for structure and recursion. You may already at hopefully have looked at these questions. And so let's start with struts and 106 00:13:41.520 --> 00:13:50.820 Wagstaff, Kiri L: I would like to know, does anybody have questions about number one, like what you. Well, I don't know how to do this when I can't see any of you. 107 00:13:52.560 --> 00:13:54.420 Wagstaff, Kiri L: But how about this. 108 00:13:57.090 --> 00:14:03.870 Wagstaff, Kiri L: I can't see your reactions. So raise your hand if you want to spend more time on question one. 109 00:14:07.470 --> 00:14:16.890 Wagstaff, Kiri L: All right, maybe we'll just talk through each one, because I think there is some interest probably just to at least be comprehensive. So here we have a structure that has three different 110 00:14:18.330 --> 00:14:34.050 Wagstaff, Kiri L: member variables in it, and in a float in a string. And the first question is saying, hey, I've declared a pointer to an animal, and I've named that variable, dear, and I'm declaring that off of the heat. So this is a dynamic allocation. 111 00:14:35.190 --> 00:14:41.520 Wagstaff, Kiri L: Of a deer variable which is of type animal and then it's asking me, How do I set the number of eyes to one. 112 00:14:42.120 --> 00:14:56.520 Wagstaff, Kiri L: So you know that it's probably going to be something to do with an eyes right and you're going to set it to one. So the question is, how do you refer to this thing and we have some choices here we can refer to deer or animal 113 00:14:57.600 --> 00:15:08.910 Wagstaff, Kiri L: But keep in mind, animal is the whole struct. So if I set that if I were able to set that to one it would sort of do it for everything. And that's not actually possible so it won't let you do this. 114 00:15:10.440 --> 00:15:20.550 Wagstaff, Kiri L: So instead, you want to focus on the variable you've defined a specific one. And the thing to keep in mind. A lot of people ask questions about doc versus arrow right 115 00:15:20.970 --> 00:15:27.330 Wagstaff, Kiri L: So let's keep in mind that.is when you have just a regular variable, you want to access. It's member variable. 116 00:15:28.170 --> 00:15:37.980 Wagstaff, Kiri L: Dear is when you have a pointer. You want to D reference it and access a member variable. So it's doing two things you can think about. It's two characters. So it's doing two things. 117 00:15:38.400 --> 00:15:46.410 Wagstaff, Kiri L: This is just accessing member variable. This is the referencing and accessing. So if you've got a pointer. You then you want to pick option to see 118 00:15:47.910 --> 00:16:06.510 Wagstaff, Kiri L: Option D. It's kind of interesting one because it would take the address of a pointer and then try to access a member variable so that wouldn't work. You can't get a member variable from just a pointer. Right. So, especially not the address of a pointer. So that's why not D. 119 00:16:09.150 --> 00:16:14.520 Wagstaff, Kiri L: Raise your hand if you have a question about this one. Let me lower all the hands first 120 00:16:16.530 --> 00:16:19.650 Wagstaff, Kiri L: Okay. Now raise your hand if you if that didn't clarify this one for you. 121 00:16:21.300 --> 00:16:22.320 Wagstaff, Kiri L: All right, we go ahead 122 00:16:24.150 --> 00:16:31.950 Liam: Hi. So I like understand the question. And I get all of it, but I just had a question about the air overs of the.in general 123 00:16:32.250 --> 00:16:45.330 Liam: Because I'm first assignment five, we were working with dynamically allocated struts and I attempted to use the arrow, because I thought that's what I was like supposed to do, but that didn't end up working and the dot did 124 00:16:46.500 --> 00:16:59.490 Liam: Is there a difference when the like kind of struck variable is part of an array, use the dot then but not if it's just the structure dynamically allocated by itself, because the arrow did not work for Sunday. 125 00:17:00.930 --> 00:17:04.050 Wagstaff, Kiri L: So an assignment five, I'm guessing you were using your to do re 126 00:17:04.410 --> 00:17:11.070 Wagstaff, Kiri L: Abstract. Yes. Right. So if you index into a 2D array. The thing you have at that point is not a pointer. 127 00:17:11.730 --> 00:17:12.210 Forever. 128 00:17:13.500 --> 00:17:15.120 Liam: That's what I thought. I just wanted to clear it up. 129 00:17:15.420 --> 00:17:19.650 Wagstaff, Kiri L: Yeah, that's a great question. So we don't have an array here so it doesn't look quite the same, but yeah. 130 00:17:20.670 --> 00:17:25.710 Wagstaff, Kiri L: If you had a pointer inside your to do right, you would need the arrow at that point. 131 00:17:29.040 --> 00:17:42.000 Wagstaff, Kiri L: All right, I don't see any other hands up maybe other folks have probably had the same question there. So, and, and yes, Alvin. If you do reference deer and then do the dot. It's the same as the arrow so perfect. 132 00:17:43.260 --> 00:17:49.800 Wagstaff, Kiri L: If you, if you saw that option. That would be a good one here and then likewise. Question two is giving you a similar request. 133 00:17:50.220 --> 00:18:02.940 Wagstaff, Kiri L: To access a member variable, but this time it is just a variable. It's not a pointer. It's just an animal, not an animal pointer. So here's where we would need to use the dot and this one would not be correct. Option C would not be correct. 134 00:18:04.350 --> 00:18:07.890 Wagstaff, Kiri L: Any questions about number two. Now that we talked through the the dot and the arrow. 135 00:18:12.840 --> 00:18:18.450 Wagstaff, Kiri L: OK. So, number three is a little bit more relevant to the question. We just had because it is actually an array. Right. 136 00:18:19.770 --> 00:18:25.740 Wagstaff, Kiri L: You know, but an array of animals have 20 animals and you've got a pointer which is getting us the address of the first one right 137 00:18:26.310 --> 00:18:40.140 Wagstaff, Kiri L: So if we want to set the animal at index to then we know we're going to have to do farm have to something and it's a dot because once we've done farming to we just have an animal, not an animal pointer. 138 00:18:41.730 --> 00:18:45.420 Wagstaff, Kiri L: So that's why option D would not work here because it's not a pointer. 139 00:18:47.370 --> 00:18:52.590 Wagstaff, Kiri L: Now, I bet some of you are able to think about, okay, given what we've just learned 140 00:18:53.700 --> 00:18:55.380 Wagstaff, Kiri L: How could I use farm. 141 00:18:56.940 --> 00:18:58.140 Wagstaff, Kiri L: With the arrow. 142 00:19:00.480 --> 00:19:10.500 Wagstaff, Kiri L: And still achieve the same goal there is a way to do that, but it's a little more contorted, so this is the best solution here. Any questions on number three. 143 00:19:15.240 --> 00:19:21.060 Wagstaff, Kiri L: I love how you're having the sideline chat if there's anything that I missed while I was talking, feel free to ask it. 144 00:19:25.890 --> 00:19:30.270 Wagstaff, Kiri L: Yeah. Very nice. Both of those are good Hayden and Elvin. 145 00:19:33.450 --> 00:19:51.540 Wagstaff, Kiri L: Let's see. Okay, number four. Now we have hypothetically two variables that are both of type animal a fox in a badger and you haven't actually seeing what they're set to but all you're asked to do here is pick an expression that will be true if the Badger weighs more than the fox. 146 00:19:52.650 --> 00:19:59.040 Wagstaff, Kiri L: So, you know, you've got to access the badgers wait and the fox is waiting then compare them. And here there's no confusion about 147 00:20:00.150 --> 00:20:13.290 Wagstaff, Kiri L: Arrows and dots, because you've only been given that option right but the assumption here is, since I said animal variable and not pointer to an animal very variable or animal star, then you would use the dot operator. 148 00:20:16.080 --> 00:20:21.810 Wagstaff, Kiri L: Options. A and B would not work because we don't have a way to compare an entire structure to an entire struct. 149 00:20:23.940 --> 00:20:25.650 Wagstaff, Kiri L: Any questions about number four. 150 00:20:32.190 --> 00:20:32.910 Wagstaff, Kiri L: Alrighty. 151 00:20:34.410 --> 00:20:36.810 Wagstaff, Kiri L: All right. Number five is is getting at. 152 00:20:38.250 --> 00:20:47.550 Wagstaff, Kiri L: Your understanding of recursive recursive functions. So here it's saying a recursive function cannot use a for loop inside its definition. 153 00:20:49.830 --> 00:21:04.410 Wagstaff, Kiri L: And although we typically would not use a for loop inside a recursive function. There's nothing that precludes that if you that's not what makes it recursive. So does anyone want to volunteer on the chat or with your hand. What would make it recursive 154 00:21:05.940 --> 00:21:10.410 Wagstaff, Kiri L: If it's not about whether it has a for loop, what is the key thing it would need in order to be recursive 155 00:21:15.750 --> 00:21:20.130 Wagstaff, Kiri L: All right, I see some great contributions there and Hayden, would you like to say something. Since you raise your hand. 156 00:21:23.310 --> 00:21:24.330 Wagstaff, Kiri L: You can go ahead Hayden. 157 00:21:27.570 --> 00:21:29.130 Wagstaff, Kiri L: If you're speaking. We can't hear you. 158 00:21:33.210 --> 00:21:35.580 Hayden Johnson: Oh, you can you can hear me. Yeah, how 159 00:21:37.980 --> 00:21:38.520 Wagstaff, Kiri L: Go ahead. 160 00:21:41.040 --> 00:21:45.600 Hayden Johnson: Yes, if it calls itself, whichever one already said but i can i can raise my hand. 161 00:21:46.440 --> 00:21:51.240 Wagstaff, Kiri L: I see no problem. Yes, I see a lot of calling itself. 162 00:21:52.590 --> 00:21:54.210 Wagstaff, Kiri L: And some bass cases. 163 00:21:55.590 --> 00:22:00.330 Wagstaff, Kiri L: Basically case and call itself. Yeah. So you guys got this down. Those are the things we're looking for. 164 00:22:00.780 --> 00:22:08.820 Wagstaff, Kiri L: Now that having a base case doesn't make it recursive, but it makes it a good recursive function because you could have a 165 00:22:09.210 --> 00:22:22.230 Wagstaff, Kiri L: function that calls itself and they forgot the base case, it would still be recursive, it would just be problematic. So it's really the calling itself. That makes it into what we would call recursive, whether it's correct or not. 166 00:22:23.610 --> 00:22:26.700 Wagstaff, Kiri L: And then there's a question here about the base case itself. 167 00:22:28.110 --> 00:22:39.750 Wagstaff, Kiri L: That this describes the condition in which the recursion stops. That is what we're looking for. So that would be true if you have a question about base case. And what that means and feel free to raise your hand. Now, 168 00:22:45.390 --> 00:22:57.720 Wagstaff, Kiri L: Okay, number seven. We're moving on to looking at how do you write recursive functions. So we have defined something called print letters and there's some gaps in it. But since I've said it's a recursive function. 169 00:22:58.710 --> 00:23:13.440 Wagstaff, Kiri L: It probably needs to call itself somewhere. So we have an if statement and the way we've looked at constructing these before, is we would put our base case here. And the question is, what would be an appropriate base case to go inside that if construction. 170 00:23:15.120 --> 00:23:24.210 Wagstaff, Kiri L: And the way I would think about this here is when do you want things to stop. So if you look at the question. It says down to a character a 171 00:23:25.980 --> 00:23:31.860 Wagstaff, Kiri L: So that is a case where I would probably borrow that from my base case. And I would look to be checking when see is equal to A. 172 00:23:33.480 --> 00:23:40.710 Wagstaff, Kiri L: If it said from character see up to pee. Then I would be checking for see being equal to pee and so on. 173 00:23:42.150 --> 00:23:50.520 Wagstaff, Kiri L: So this is when you want it to stop. This is when you're in your final iterate your final work through the recursion and we're just printing the character itself. 174 00:23:51.870 --> 00:24:01.350 Wagstaff, Kiri L: Alternatively, if we're not at a then this will be the recursive part and it's asking. In question eight, what, what would you put in the blank labels to 175 00:24:01.830 --> 00:24:09.690 Wagstaff, Kiri L: Where you know you need to call print letters and it's like, what do you call it with right so what we've talked about with recursion is you're trying to make the problem smaller 176 00:24:10.230 --> 00:24:21.570 Wagstaff, Kiri L: So you start with I'm at character. See, and I need to walk all the way down to a whatever see happens to be so see could be any letter of the alphabet. It could even start a day. Right. 177 00:24:22.290 --> 00:24:30.450 Wagstaff, Kiri L: In which case this would immediately execute and you would never get to the recursive step but assuming it's not a you're in the else case. 178 00:24:31.170 --> 00:24:39.870 Wagstaff, Kiri L: So you're going to call print letters with one character smaller than the one you just started with. So because we can treat characters. 179 00:24:40.410 --> 00:24:49.920 Wagstaff, Kiri L: As integers, we can just subtract one from it, and if it started out as queue, then it would become P and if it started out as D would become see and so on. 180 00:24:50.460 --> 00:24:58.350 Wagstaff, Kiri L: For the recursive stuck working its way down to a and notice. Anyone want to volunteer in the chat. What would happen if we put a in there. 181 00:25:02.370 --> 00:25:08.580 Wagstaff, Kiri L: Yes, infinite loop. So you're going to keep calling it with whatever see is, and whatever see is, and whatever see is, and whatever see is 182 00:25:09.150 --> 00:25:17.220 Wagstaff, Kiri L: And unless you happen to call the starting with a. In which case you escaped here. Any other letter would just keep going and going and going and going and going. 183 00:25:18.390 --> 00:25:24.090 Wagstaff, Kiri L: Until you fill up the stack and you have a sec fault. So that's not a good choice. 184 00:25:25.050 --> 00:25:37.680 Wagstaff, Kiri L: And then this is just here in case you weren't really paying attention and you just were fixated on see and you put in the letter C. So that would also, unfortunately, give you an infinite recursion and it's like fall 185 00:25:38.700 --> 00:25:41.610 Wagstaff, Kiri L: Because it would just keep calling it with CC CC CC 186 00:25:42.630 --> 00:25:50.400 Wagstaff, Kiri L: And then this one wouldn't work at all, because if you didn't give it something to rehearsal on there's no input argument here. 187 00:25:51.780 --> 00:25:57.120 Wagstaff, Kiri L: Questions about seven or eight since they kind of go together. Raise your hand if you'd like to ask 188 00:26:02.580 --> 00:26:10.110 Wagstaff, Kiri L: Okay, good. I think you've had a lot of practice with recursion. And we've been working on it for quite a while and class. So I'm expecting you'll do well with this. 189 00:26:11.340 --> 00:26:14.730 Wagstaff, Kiri L: Alright, the last two questions are about this recursive function called play 190 00:26:16.320 --> 00:26:19.800 Wagstaff, Kiri L: And in this one. It takes in an integer returns a float. 191 00:26:20.880 --> 00:26:27.270 Wagstaff, Kiri L: Before this one was void, right, because I was doing is printing things out. This one's actually going to return something 192 00:26:27.990 --> 00:26:42.240 Wagstaff, Kiri L: And the base cases if x is negative one, then return 1.5 and for anything else you're going to return 3.6 plus calling play on x minus one. So, first question is, if I pass in zero 193 00:26:43.320 --> 00:27:01.530 Wagstaff, Kiri L: Then what would that return and for this I definitely encourage you to use scratch paper while you're taking this exam, even though it's on canvas handwriting things can be really helpful for recursive functions super helpful. So I would recommend that you actually traced these through 194 00:27:02.700 --> 00:27:04.140 Wagstaff, Kiri L: So you would do something like 195 00:27:05.190 --> 00:27:06.330 Wagstaff, Kiri L: See if I can write on here. 196 00:27:08.040 --> 00:27:12.750 Wagstaff, Kiri L: You would say, okay, play of zero. 197 00:27:13.920 --> 00:27:17.970 Wagstaff, Kiri L: Equals and let's see if I can make this better. 198 00:27:26.220 --> 00:27:36.810 Wagstaff, Kiri L: Alright, that's probably better than me trying to draw right so right out what that becomes if I pass in zero, it becomes 3.6 plus play minus one right 199 00:27:38.820 --> 00:27:47.010 Wagstaff, Kiri L: And looks like I have to do this separately every single time that is the same as 3.6 plus 200 00:27:51.000 --> 00:27:58.440 Wagstaff, Kiri L: 1.5 right because you get down to the negative one, that is the base case and it returns and that is the same as 201 00:28:00.030 --> 00:28:02.250 Wagstaff, Kiri L: 5.1 if you do the arithmetic. 202 00:28:03.840 --> 00:28:06.360 Wagstaff, Kiri L: So any questions about how that works. 203 00:28:08.220 --> 00:28:21.540 Wagstaff, Kiri L: You can probably do this in your head. If it's just a couple steps, but I highly highly recommend that you do it just like I showed here like write it down, scratch paper and work it out. If it goes more than a couple iterations, it becomes very hard to keep track of in your head. 204 00:28:24.720 --> 00:28:34.920 Wagstaff, Kiri L: Alright, same thing here, on question 10 it's asking a slightly different question of how many times, will the function be called if we start with lay have to 205 00:28:38.970 --> 00:28:42.390 Wagstaff, Kiri L: Actually, I'm curious. Do you see that while I'm typing or only after I'm done typing. 206 00:28:46.980 --> 00:28:53.790 Wagstaff, Kiri L: While typing a. Yeah, that's even better. Okay. So play have to someone type into the chat. What that expands to 207 00:29:03.150 --> 00:29:03.660 Wagstaff, Kiri L: Anyone 208 00:29:11.370 --> 00:29:25.290 Wagstaff, Kiri L: Alright. Some of you are commenting about questions seven. Hang on. We'll we're working on question 10. Okay, so a lot of great answers here. I would start with the 3.6 because that straightforward, plus the play of whatever I had minus one. 209 00:29:26.700 --> 00:29:29.100 Wagstaff, Kiri L: And then I would keep expanding that 210 00:29:33.540 --> 00:29:38.340 Wagstaff, Kiri L: Just like what I'm seeing you guys doing in the chat, which is great. Keep doing this. 211 00:29:45.240 --> 00:29:48.660 Wagstaff, Kiri L: That's plenty of negative one and then work it out. 212 00:29:49.950 --> 00:29:52.140 Wagstaff, Kiri L: And yes, it is very easy to 213 00:29:53.520 --> 00:29:56.400 Wagstaff, Kiri L: Have an extra one or one that's too small. Right. 214 00:30:07.140 --> 00:30:09.480 Wagstaff, Kiri L: Here we go. This is fun watching me type, I'm sure. 215 00:30:14.970 --> 00:30:15.330 Wagstaff, Kiri L: Oh, 216 00:30:16.680 --> 00:30:19.680 Wagstaff, Kiri L: I got carried away. This is pretty hard to do live 217 00:30:21.900 --> 00:30:23.130 Wagstaff, Kiri L: Okay, is that looking better. 218 00:30:29.010 --> 00:30:30.780 Wagstaff, Kiri L: Okay. Glad you approve. 219 00:30:33.630 --> 00:30:34.530 Wagstaff, Kiri L: It's not quite right, though. 220 00:30:35.970 --> 00:30:37.950 Wagstaff, Kiri L: Oh, it doesn't let me edit what I already wrote 221 00:30:50.280 --> 00:30:57.600 Wagstaff, Kiri L: Okay. Anyway, the point is, it's not even asking you to figure out what the answer is it's asking you to figure out how many times the function will be called which is 222 00:30:58.050 --> 00:31:10.980 Wagstaff, Kiri L: Actually simpler. So the key is to remember that that first call play of two counts. Okay, so we're calling it once with play have to which calls play have one, which calls play of zero, which calls play of negative one. 223 00:31:12.510 --> 00:31:18.930 Wagstaff, Kiri L: So if I count every time I wrote down the word play I come up with four. And that's how we end up with the right answer here. 224 00:31:20.010 --> 00:31:20.610 Wagstaff, Kiri L: So, 225 00:31:22.260 --> 00:31:27.810 Wagstaff, Kiri L: Haha oh database, the entire thing. This is great. I'm getting to learn how to use this as well. 226 00:31:29.490 --> 00:31:31.770 Wagstaff, Kiri L: I was trying to just erase that extra 3.6 227 00:31:33.660 --> 00:31:43.260 Wagstaff, Kiri L: But anyway, I think you get the idea. And any questions about this one that we haven't already addressed, please raise your hand. 228 00:31:53.160 --> 00:32:02.100 Wagstaff, Kiri L: And Benny that that wouldn't be quite right, because we need to actually replace the function calls with their recursive versions not add to them every single time. 229 00:32:05.610 --> 00:32:11.220 Wagstaff, Kiri L: Okay, now, I think, was there a question about, Oh, it looks like I need to clear this 230 00:32:15.660 --> 00:32:17.520 Wagstaff, Kiri L: Okay, question about number seven. 231 00:32:20.880 --> 00:32:27.660 Wagstaff, Kiri L: Ah, yes. So there is, it looks like it got deleted the final closing curly brace. Very good. I so that is missing. 232 00:32:28.680 --> 00:32:29.790 Wagstaff, Kiri L: From this example. 233 00:32:31.380 --> 00:32:35.580 Wagstaff, Kiri L: All right. Those were the questions I had prepared for you in terms of recursion instructs 234 00:32:36.840 --> 00:32:41.790 Wagstaff, Kiri L: Do you have any questions that we didn't cover so far on those two topics. 235 00:32:43.680 --> 00:32:45.090 Wagstaff, Kiri L: Please raise your hand if you do 236 00:32:50.310 --> 00:32:51.540 Wagstaff, Kiri L: All right, Tyler. Go ahead. 237 00:33:00.780 --> 00:33:05.880 Wagstaff, Kiri L: Tyler. I'm trying to unmute you. But it's not working. Do you, I'm not sure. There you go. Yeah. 238 00:33:06.870 --> 00:33:08.010 Tyler Branson: I tried to ask this earlier. 239 00:33:08.460 --> 00:33:16.560 Tyler Branson: Is the, I don't have a grade yet for peer reviews for Simon five, I was curious if when the summer five grade comes out, that's going to be put into the great book of that time. 240 00:33:18.420 --> 00:33:21.480 Wagstaff, Kiri L: For the parodies are for the assignment itself. Are you asking about both 241 00:33:22.620 --> 00:33:29.850 Tyler Branson: I just don't have a great from peer reviews. Right now I can understand that we're waiting till about latest Sunday for the assignment five grade and total 242 00:33:30.000 --> 00:33:30.300 Wagstaff, Kiri L: Okay. 243 00:33:30.390 --> 00:33:32.430 Tyler Branson: But I was worried that peer review is going to be put in as 244 00:33:32.490 --> 00:33:33.300 Tyler Branson: At that time, as well. 245 00:33:33.660 --> 00:33:38.790 Wagstaff, Kiri L: Yes, the. Those should all be taken care of at latest by that same point. 246 00:33:39.150 --> 00:33:49.650 Wagstaff, Kiri L: It is my understanding that all of the design documents have been graded. So if you're not seeing a grade for your assignment five design doc, then please let us know through the TA list which goes to all of us, including me. 247 00:33:50.700 --> 00:33:54.840 Wagstaff, Kiri L: But yeah, the peer reviews might not be in quite yet. And the implementations 248 00:33:56.610 --> 00:33:56.940 Tyler Branson: Thank you. 249 00:34:01.740 --> 00:34:02.730 Wagstaff, Kiri L: Any other questions. 250 00:34:05.880 --> 00:34:11.160 Wagstaff, Kiri L: Question about the recording. I will send out a link. After this, so you can access it as needed. 251 00:34:15.540 --> 00:34:17.610 Wagstaff, Kiri L: Okay, any questions about recursion and strokes. 252 00:34:20.100 --> 00:34:24.060 Wagstaff, Kiri L: I'm not hearing any which means we have plenty of time to go back 253 00:34:25.260 --> 00:34:26.850 Wagstaff, Kiri L: And consider some of these topics. 254 00:34:27.990 --> 00:34:32.880 Wagstaff, Kiri L: Please raise your hand if you there's a topic on there. You really want to ask about or work on 255 00:34:37.260 --> 00:34:38.310 Wagstaff, Kiri L: All right, go ahead. 256 00:34:39.180 --> 00:34:40.980 huyng: I'm for the script. 257 00:34:42.210 --> 00:34:45.930 huyng: Does it count as a class if you include a function 258 00:34:48.510 --> 00:34:54.900 Wagstaff, Kiri L: Interesting question. Technically, no you if you want a class, you would have to use it the class keyword, not the struct one 259 00:34:55.350 --> 00:34:59.130 Wagstaff, Kiri L: So if it's a struct, even if it has a function, it is still a struct. 260 00:35:02.340 --> 00:35:02.670 Wagstaff, Kiri L: Yep. 261 00:35:04.620 --> 00:35:18.450 Wagstaff, Kiri L: And yes to the question about the final will be a combination of these questions and mid term to like questions. That is right. So the midterm is, I'm sorry, the final is not just on structure and recursion. It is comprehensive so can cover everything 262 00:35:22.110 --> 00:35:26.520 Wagstaff, Kiri L: I see a request for operator precedence. So why don't we take a look at that. 263 00:35:30.030 --> 00:35:44.040 Wagstaff, Kiri L: Here's our sort of reference. We've spent a lot of time with arithmetic relational operators, that's when you're comparing things for equality greater than, less than and so on, logical operators which are things that operate on Boolean 264 00:35:45.390 --> 00:35:51.480 Wagstaff, Kiri L: To say if things, both are true. If one or the other is true and if it is not true. 265 00:35:53.010 --> 00:36:03.630 Wagstaff, Kiri L: And then I bolted the ones that we've had more recently as operators, because they're a little bit newer including a re indexing and working with pointers and strokes, so 266 00:36:04.680 --> 00:36:10.140 Wagstaff, Kiri L: These can be a little trickier. Right. So if you use the ampersand in front of something, it's giving you the address of it. 267 00:36:10.560 --> 00:36:26.460 Wagstaff, Kiri L: For using the asterisk in front of it. It's the referencing that's going from a pointer to a value. This is going from a value up to a pointer or address and then we already talked about the dot and arrow operators and how this one is doing two things in this one's only doing one thing 268 00:36:29.340 --> 00:36:34.260 Wagstaff, Kiri L: Do you have any specific questions about the precedence. 269 00:36:36.390 --> 00:36:38.670 Wagstaff, Kiri L: The chart is there on the right. 270 00:36:41.640 --> 00:36:49.740 Wagstaff, Kiri L: But it's, it's kind of a lot to digest. I think it's better to think of it conceptually to know that these relational and sorry 271 00:36:50.160 --> 00:36:59.790 Wagstaff, Kiri L: The assignment operators are at the bottom. Then we have logical than the relational whoops, then the arithmetic, including mod. Don't forget mod 272 00:37:00.660 --> 00:37:13.350 Wagstaff, Kiri L: And then you've got things that are operating on pointers and addresses and the indexing dot and arrows up here along with the increment document are the very best and highest so 273 00:37:15.180 --> 00:37:16.020 Wagstaff, Kiri L: You're not seeing it. 274 00:37:18.930 --> 00:37:23.070 Wagstaff, Kiri L: Okay. Are you guys seeing the review questions. Are you seeing my slides. 275 00:37:26.130 --> 00:37:28.140 Wagstaff, Kiri L: That's interesting because I'm seeing the slides. 276 00:37:29.550 --> 00:37:30.060 Wagstaff, Kiri L: Hang on. 277 00:37:31.530 --> 00:37:33.690 Wagstaff, Kiri L: How about now. What do you are you seeing the slides. 278 00:37:36.000 --> 00:37:37.890 Wagstaff, Kiri L: Okay, I'm 279 00:37:43.410 --> 00:37:47.160 Wagstaff, Kiri L: Okay I fixed it, I think. Can you see the slides now. Okay. 280 00:37:48.300 --> 00:37:50.160 Wagstaff, Kiri L: All right, thank you for letting me know. 281 00:37:54.360 --> 00:38:09.540 Wagstaff, Kiri L: What I just said still applies. I was walking through this list of bullet points with the different operators and then the precedence. So I'll just refresh on that, since you couldn't see it. But I think of this conceptually and blocks like at the bottom things involving assignment. 282 00:38:10.740 --> 00:38:24.630 Wagstaff, Kiri L: Then moving up to the logical operators, the relational operators that are comparing values than the arithmetic. And this is where I was pointing at mod, then things that operate on memory addresses and pointers. 283 00:38:26.010 --> 00:38:28.230 Wagstaff, Kiri L: And the prefix version. 284 00:38:29.430 --> 00:38:42.450 Wagstaff, Kiri L: Of incremental document and then at the very top, the post fixed version of increment detriment are indexing and then the dot and error operators. So thanks for letting me know, you couldn't see it. I hope this is better. 285 00:38:44.430 --> 00:38:48.930 Wagstaff, Kiri L: So I'll ask again, then any specific questions here things you're confused about. 286 00:38:55.230 --> 00:38:56.550 Wagstaff, Kiri L: All right, go ahead at the beck 287 00:39:02.820 --> 00:39:06.030 Wagstaff, Kiri L: What it depends what operator, you're doing on the double pointer. 288 00:39:06.300 --> 00:39:06.780 So, 289 00:39:08.040 --> 00:39:17.070 Wagstaff, Kiri L: Remember these are not objects. These are operators. So if P were a double pointer here and I did asterisk in front of it. 290 00:39:17.610 --> 00:39:30.690 Wagstaff, Kiri L: That would be reference it by one level. So it's still be a single point. At that point, but the operator itself would have the same precedence that it has on this chart, no matter what you put in this p, whether it's double point or single point or whatever. 291 00:39:35.850 --> 00:39:36.690 Wagstaff, Kiri L: Any other questions. 292 00:39:41.970 --> 00:39:50.850 Wagstaff, Kiri L: Okay, now I'll go back to this menu that I thought you were saying before, feel free to pick something from here that you'd like us to talk more about 293 00:40:02.490 --> 00:40:04.980 Wagstaff, Kiri L: Are linked lists going to be on the final. 294 00:40:06.570 --> 00:40:08.250 Wagstaff, Kiri L: I see someone asking about that. 295 00:40:09.600 --> 00:40:17.250 Wagstaff, Kiri L: No, we're just going to go with structure and recursion, but not necessarily putting them together like we did at the very end of class. 296 00:40:18.690 --> 00:40:26.730 Wagstaff, Kiri L: RC strings going to be on the final. Yes, they are. So I'm seeing some boats for that. Why don't we skip to that one. 297 00:40:28.260 --> 00:40:29.940 Wagstaff, Kiri L: It's pretty far down on my list here. 298 00:40:38.130 --> 00:40:51.060 Wagstaff, Kiri L: Here we go. So here are some of our questions from before about see style strings. I think the key thing to remember, there is what makes us see style string, different from just an array of characters. 299 00:40:52.440 --> 00:41:05.370 Wagstaff, Kiri L: So you can think of all character raises one one type of thing and then seesaw strings is a special case of that because it has to end with angel terminator. Yes, which can be represented as backslash zero 300 00:41:06.660 --> 00:41:07.230 Wagstaff, Kiri L: M. 301 00:41:08.370 --> 00:41:12.180 Wagstaff, Kiri L: So that's a good one. And then knowing what library, you would need to include 302 00:41:13.620 --> 00:41:14.850 Wagstaff, Kiri L: To be able to use them. 303 00:41:17.490 --> 00:41:23.760 Wagstaff, Kiri L: That's another good one to know anyone wants to volunteer that I like how you're typing in the in the chat. 304 00:41:26.580 --> 00:41:27.570 Wagstaff, Kiri L: All right, very good. 305 00:41:29.670 --> 00:41:33.000 Wagstaff, Kiri L: And I see Dylan has a question. So Dylan. Go ahead. 306 00:41:34.020 --> 00:41:34.560 Dylan Karambut: Also 307 00:41:35.820 --> 00:41:40.980 Dylan Karambut: Forget the military state. But if you forget the NULL terminator. What's gonna be happening. 308 00:41:41.850 --> 00:41:44.550 Wagstaff, Kiri L: Yeah, if you forget the terminator. What a great question. 309 00:41:46.650 --> 00:41:58.740 Wagstaff, Kiri L: So if you forget the NULL terminator. Then you just have an a list of characters. Right. A, B, C, D, and then that's the end of your array which means you're up against some other piece of memory. 310 00:41:59.610 --> 00:42:09.210 Wagstaff, Kiri L: So if you want to use any of the string functions that are in the Ses. Ses string library. They are all scanning through your string to look for a know 311 00:42:09.720 --> 00:42:13.710 Wagstaff, Kiri L: If they don't find it. They'll keep going until they find one. So, 312 00:42:14.220 --> 00:42:21.510 Wagstaff, Kiri L: If you get lucky and there happens to be a normal right after your array in memory, it will stop at the appropriate place and you won't realize you have a bug. 313 00:42:22.080 --> 00:42:29.610 Wagstaff, Kiri L: If you're unlucky, it will keep walking through any valid memory until it runs into a funnel and so you may get garbage coming out. 314 00:42:30.060 --> 00:42:36.000 Wagstaff, Kiri L: And that's the kind of bug that can be very hard to notice especially if you did as I say get lucky and there was a null. 315 00:42:36.900 --> 00:42:46.980 Wagstaff, Kiri L: SEC memory hadn't been used or something. So that's a really good thing to run with algorithms and it will give you that very cryptic error that talks about blah blah blah and initialized variable. 316 00:42:48.630 --> 00:42:53.580 Wagstaff, Kiri L: Or it will often give you that error, it won't say hey you forgot your know Terminator 317 00:42:53.940 --> 00:43:02.970 Wagstaff, Kiri L: But that's one of the causes of getting that error. So, that can be a clue to you if you run Belgrade and you have no memory leaks, but it's still giving you these warnings, I would check your see cell streams. 318 00:43:10.350 --> 00:43:18.030 Wagstaff, Kiri L: We've got the whole character and we've got seen and get line and I see some chat here as well that people are talking about that. 319 00:43:18.870 --> 00:43:30.840 Wagstaff, Kiri L: Hopefully, at this point, you've had enough experience now to know if you just, you see, and it will stop when you ever hits white space and white space can include spaces tabs or anything that's not 320 00:43:32.070 --> 00:43:44.520 Wagstaff, Kiri L: A literal here. The get line is the safe way to do that because it will only read in the number that you're asking for. And since you had to allocate that array. It's really good to match that up with what you are asking for. 321 00:43:45.270 --> 00:43:51.720 Wagstaff, Kiri L: And there was some questions. We already had about okay if I put 10 there. What is that actually going to do 322 00:43:52.860 --> 00:43:56.850 Wagstaff, Kiri L: Is that going to read nine or read 10. What do you think, put it in the chat. 323 00:44:01.740 --> 00:44:04.920 Wagstaff, Kiri L: Alright, just based on your votes. I'm seeing a whole lot of nines. 324 00:44:06.030 --> 00:44:12.030 Wagstaff, Kiri L: Yeah, so it's going to read nine valid characters from the input and then put the knoll on there for you. 325 00:44:12.510 --> 00:44:21.360 Wagstaff, Kiri L: So the total number of characters that will, it will consume that will be stored in your array is 10 but you have to know that that 10th. One is the special one. 326 00:44:22.170 --> 00:44:31.890 Wagstaff, Kiri L: It's the little Terminator, and they will only get nine from the user. So great job on that. That's what we really want you to understand. You may be wondering like why do we care. Why is it so picky. 327 00:44:32.850 --> 00:44:39.870 Wagstaff, Kiri L: And it's really just to help you avoid making memory mistakes that could cause problems downstream so 328 00:44:41.070 --> 00:44:42.030 Wagstaff, Kiri L: Hopefully that's helpful. 329 00:44:43.050 --> 00:44:48.600 Wagstaff, Kiri L: All right, we spent some time on see strings. I think there was a question about function overloading as well. 330 00:44:50.280 --> 00:44:52.560 Wagstaff, Kiri L: In the chat so I'm 331 00:44:53.670 --> 00:45:05.220 Wagstaff, Kiri L: Someone in the chat, then please share what do you need to have different between two functions that have the same name for the compiler to allow you to have more than one 332 00:45:09.750 --> 00:45:14.940 Wagstaff, Kiri L: Yes, there needs to be some difference in the parameters, either in how many you have. 333 00:45:16.290 --> 00:45:17.490 Wagstaff, Kiri L: Or their types. 334 00:45:18.900 --> 00:45:34.020 Wagstaff, Kiri L: It's not enough for the name of the parameter to be different. So if one, you know, one function that takes an int a the other one takes an int be that's not good enough because those variable names are only local to the function. So it needs to be a different type or different amount 335 00:45:35.820 --> 00:45:47.670 Wagstaff, Kiri L: And you can have the return type be different. But if that's the only thing that's different. That won't work either. So that's another gotcha to remember if you just change from a return type of into a return type of void not good enough. 336 00:45:50.040 --> 00:45:59.790 Wagstaff, Kiri L: I also saw a question about whether we would have to know value and for the test value and will not be on the test. I just mentioned it because it's a good programming tool as you go forward into your studies and your programming. 337 00:46:00.660 --> 00:46:13.680 Wagstaff, Kiri L: Same with GDP. So this test is very like what we've had before, on paper, we're mainly more looking at. Do you know the language and its features and the tools or what you use in the lab and in your programming. 338 00:46:15.600 --> 00:46:21.030 Wagstaff, Kiri L: No, I don't have a slide on function overloading. I don't think so. That's why I didn't change it. Thanks for asking. 339 00:46:22.410 --> 00:46:23.580 Wagstaff, Kiri L: I just had to talk it through with you. 340 00:46:25.170 --> 00:46:26.700 Wagstaff, Kiri L: Alrighty, um, 341 00:46:28.770 --> 00:46:31.830 Wagstaff, Kiri L: I go back to our topics. 342 00:46:33.990 --> 00:46:36.330 Wagstaff, Kiri L: What's another popular one. You want to talk about or 343 00:46:44.040 --> 00:46:46.830 Wagstaff, Kiri L: 2D arrays. I think that's an excellent choice. 344 00:46:48.420 --> 00:47:00.570 Wagstaff, Kiri L: Let's go take a look at that and dynamic memory is another good one. Why don't we try to hit both of those, and the time we have. So I'm hoping that by now you've gained enough familiarity with 2D arrays that you would feel comfortable declaring 345 00:47:01.620 --> 00:47:18.330 Wagstaff, Kiri L: A 2D array or at least knowing how that is done. I'm not going to ask you to write long pieces of code, just like I haven't done that on the paper exams, either, but you should understand how static to do rays are declared so you could recognize and read code that that does use that 346 00:47:19.770 --> 00:47:28.440 Wagstaff, Kiri L: So anyone wants to volunteer and the the chat, how you would declare a static 2D array that's a four by five array of doubles. 347 00:47:32.070 --> 00:47:34.080 Wagstaff, Kiri L: And make sure you put the data type in there too. 348 00:47:37.470 --> 00:47:42.660 Wagstaff, Kiri L: Yeah. Okay, so I'm seeing a lot of answers on this, if you wanted it to be five by for what would you do 349 00:47:47.610 --> 00:48:06.060 Wagstaff, Kiri L: Okay. Yeah, exactly. You need to switch the order because you always put the number of rows first and then the number of columns. So we've got that here. And then we get this question a lot is very laid out in row major column manager. I hope you can all get this 350 00:48:07.500 --> 00:48:13.320 Wagstaff, Kiri L: Hope. There's lots of votes for yes row, even if you misspell it that's okay as long as you recognize that 351 00:48:13.680 --> 00:48:25.740 Wagstaff, Kiri L: It's also I hopefully you had a good sense of what that means right so we take the first row in the array and then we stack the next row in the array contactor it third row. The fourth row and so on. 352 00:48:26.130 --> 00:48:31.440 Wagstaff, Kiri L: All the way. So we do not lay out columns and then columns and then columns which would be the alternative 353 00:48:34.560 --> 00:48:49.050 Wagstaff, Kiri L: All right. Now, the more challenging one. How do you allocate memory for a dynamic 2D array. So let's do the same thing. Let's create a 2D array of doubles. That's four by five. Yes. From the heat. So if you ever see dynamic that means from the heat. 354 00:48:52.290 --> 00:49:06.000 Wagstaff, Kiri L: And we'll talk about the array passing there. And in a sec. Yeah. Using a for loop. So there are two major steps you need to do. Right. So first one you need to declare your row pointers and I see some 355 00:49:08.160 --> 00:49:15.270 Wagstaff, Kiri L: Some ideas on that. Yep, let's make sure that you have the right number we have four rows here, not five 356 00:49:15.780 --> 00:49:29.970 Wagstaff, Kiri L: And you make sure that you've got the right data type two with a double pointer on the left side and the single pointer on the right side of the assignment statement. All right, I'm seeing a lot of great examples. So anyone who's not typing. Hopefully you're seeing those two 357 00:49:31.380 --> 00:49:33.120 Wagstaff, Kiri L: For that last one. You will need 358 00:49:35.280 --> 00:49:44.430 Wagstaff, Kiri L: You will need. It's a double star on the right side of the assignment, not just the double otherwise your types won't match. So you're declaring an array of double pointers. 359 00:49:46.020 --> 00:49:50.580 Wagstaff, Kiri L: You know what I just realized the double data type is confusing here because we're using double in two ways. 360 00:49:52.350 --> 00:49:56.520 Wagstaff, Kiri L: I mean the data type and array of double data type pointers. 361 00:49:58.080 --> 00:50:14.040 Wagstaff, Kiri L: Then you would have the for loop, which you're all getting at, where you assign for every item within that array of real pointers, something that it's actually going to point two. So you would have each array of i is a new double of five. So four by five array. 362 00:50:15.600 --> 00:50:20.610 Wagstaff, Kiri L: So this is really good practice to be able, I love how you're all putting it out there. 363 00:50:21.660 --> 00:50:27.360 Wagstaff, Kiri L: Again, I won't ask you to write this down off the top of your head, but you should be able to recognize when it's right and when it's wrong. 364 00:50:28.650 --> 00:50:40.620 Wagstaff, Kiri L: So like if I had an extra pointer here. If you can see where my pointer is an extra star in here that would be wrong, because we don't want double star. We just want a double array. 365 00:50:42.540 --> 00:50:51.150 Wagstaff, Kiri L: Then the next question is, how do you free that and for that of course we want to flip the order, we have our for loop first to free every rope. 366 00:50:52.890 --> 00:51:07.050 Wagstaff, Kiri L: Array. And then at the end, we are delete the main variable itself, which is the array A row pointers doing it the other order does not work. It's fun to try, if you want, but it will not work. 367 00:51:08.430 --> 00:51:09.390 Wagstaff, Kiri L: It'll cause problems. 368 00:51:11.280 --> 00:51:13.920 Wagstaff, Kiri L: And otherwise, the for loop structure is exactly the same. 369 00:51:16.140 --> 00:51:17.190 Wagstaff, Kiri L: All right. Um, 370 00:51:18.240 --> 00:51:27.450 Wagstaff, Kiri L: See, there was question then about function. How do we pass these things into functions. And this is a very good question, ask because it's a little fiddly 371 00:51:27.930 --> 00:51:39.870 Wagstaff, Kiri L: So in this case, we've got an array of it's a 2D Arabians it's five by three static. So hopefully you can all think of, okay, how would I declare that thing. Um, what should a function call look like 372 00:51:41.520 --> 00:51:50.160 Wagstaff, Kiri L: And we'll just take a look at that. Here we have a function in this case it's void that has nothing to do with the question. The real key is what you put inside here, right. 373 00:51:50.550 --> 00:52:00.060 Wagstaff, Kiri L: And so you can you can actually say it's five by three static array or you can say it's something by three and not reveal what the something is 374 00:52:04.560 --> 00:52:15.510 Wagstaff, Kiri L: Right, I just realized we were only going to 250. So thank you. SEBASTIAN. If anyone needs to leave. I completely understand, we'll finish up a couple more questions here for anyone who can stay 375 00:52:16.920 --> 00:52:24.690 Wagstaff, Kiri L: So this is the key really need to have that second one, the second dimension and yes I will post the slides and the recording. So watch for an email about that. 376 00:52:26.310 --> 00:52:35.730 Wagstaff, Kiri L: Then how would you do it for dynamic that's the other one where you actually just pass in pointer pointer or array of pointers either one. 377 00:52:38.310 --> 00:52:50.370 Wagstaff, Kiri L: Ah, great question from Zach. If you passed in row and column here like before, like you passing the three in the five somehow his arguments could you use them here. No, you cannot. That would be really great. 378 00:52:50.970 --> 00:53:04.920 Wagstaff, Kiri L: I totally know what you're asking. Thanks for typing in the example know that will not work. You can't define a variables of parameter and then use it in the parameters, unfortunately. So yeah, you have to actually know how big it is, before you pass it in as part of this. 379 00:53:06.150 --> 00:53:06.540 Wagstaff, Kiri L: Okay. 380 00:53:07.740 --> 00:53:18.120 Wagstaff, Kiri L: Yes, we actually got to talk about dynamic memory allocation as well in this process. Any final questions about well static or dynamic memory allocation in the time we have. 381 00:53:25.860 --> 00:53:29.160 Wagstaff, Kiri L: You if you ask the user for the Rowan column before you create it. 382 00:53:29.970 --> 00:53:36.630 Wagstaff, Kiri L: So if you're asking the user for their own column size, then you would be using dynamic allocation. So you'd be in the second case. 383 00:53:36.960 --> 00:53:42.960 Wagstaff, Kiri L: And you don't need to specify what those are. When you call them when you pass them into the function. So, yeah, no work. 384 00:53:43.950 --> 00:53:52.590 Wagstaff, Kiri L: And to call the function Darian. Thank you, you would just use a are well whatever your it might not be called AR right but whatever you call it inside your main 385 00:53:53.340 --> 00:54:01.410 Wagstaff, Kiri L: You don't put an asterisk in front of it or behind it, or an ampersand or anything, just the name of the array because you're passing in that double pointer as the argument. 386 00:54:04.890 --> 00:54:06.420 Wagstaff, Kiri L: Does that answer your question Darian 387 00:54:07.650 --> 00:54:14.190 Wagstaff, Kiri L: Yeah, perfect. Okay, any other questions about how you call the function and pass in the argument. 388 00:54:16.110 --> 00:54:20.310 Wagstaff, Kiri L: I mean, you can see here, I didn't pass in row and column as arguments here. 389 00:54:20.730 --> 00:54:28.320 Wagstaff, Kiri L: And that's fine. That works, but it may limit what I can do inside that function because I inside the function, I will have no idea what the dimensions are of this thing. 390 00:54:28.860 --> 00:54:36.570 Wagstaff, Kiri L: So it's much better to add the wrong column. I just didn't show them here. So we could focus on how do you pass that particular argument. 391 00:54:39.210 --> 00:54:39.750 Wagstaff, Kiri L: All right. 392 00:54:42.030 --> 00:54:47.730 Wagstaff, Kiri L: We still have anyone people here. So, have you at one people. I'm sure you must have at least one question, feel free to ask 393 00:54:49.650 --> 00:55:00.300 Wagstaff, Kiri L: If we had a pointer named array. What is the difference between these yes you have very good question. So let's say array as a pointer to 394 00:55:01.170 --> 00:55:13.680 Wagstaff, Kiri L: An event. I don't know. So if you have. Oh, you're just saying if we print them out if you print a ROI. Yes, anyone wants to answer that one. First one, what would we get if we print a ROI. 395 00:55:23.220 --> 00:55:34.920 Wagstaff, Kiri L: Okay, I'm good. Yeah. So the first one is just going to be an address if you print a ROI will not give you all the contents of the array like some other languages. My it will just give you the address of the start of the array. 396 00:55:35.520 --> 00:55:45.600 Wagstaff, Kiri L: And percent then as the address of that address and ampersand D reference of the array would be first, we would do. 397 00:55:48.990 --> 00:55:52.200 Wagstaff, Kiri L: I'm actually not sure that it would compile as written. 398 00:55:54.690 --> 00:56:03.480 Wagstaff, Kiri L: But I'd have to test it. So if anyone wants to test it. I can see conceptually what you're going for is up and then down but that will be kind of weird. 399 00:56:05.280 --> 00:56:20.970 Wagstaff, Kiri L: Can we use link to find her own column values so length is something that you have, for example, for a season of sorry a c++ string that is defined for that object class it's not defined for a race. So unfortunately don't have that. 400 00:56:22.770 --> 00:56:23.340 Wagstaff, Kiri L: Um, 401 00:56:24.360 --> 00:56:27.630 Wagstaff, Kiri L: What would happen if you put an arrow in the struct. 402 00:56:29.160 --> 00:56:33.030 Wagstaff, Kiri L: Show. I think I need more details about you mean by putting an arrow in the struct. 403 00:56:34.650 --> 00:56:43.110 Wagstaff, Kiri L: We defined a pointer inside the struct. And then we use the arrow. Whenever we were D referencing a pointer, if that's what you're referring to. 404 00:56:52.200 --> 00:56:52.770 Wagstaff, Kiri L: Okay. 405 00:56:54.780 --> 00:56:55.620 Wagstaff, Kiri L: So, 406 00:56:57.000 --> 00:57:03.840 Wagstaff, Kiri L: Can you can you ask your question or would you like to use the mic. So you can ask it a little more easily just raise your hand if you want to use the mic. 407 00:57:09.120 --> 00:57:11.700 Sho: Yeah, I have a question about, like, when 408 00:57:12.840 --> 00:57:21.840 Sho: When we I don't understand a slider nutrition. I think last week about the when, when we, when you do the train like you've done a question. 409 00:57:26.010 --> 00:57:28.230 Wagstaff, Kiri L: Yeah, I, I'm here. Um, 410 00:57:29.430 --> 00:57:29.820 Wagstaff, Kiri L: I think 411 00:57:30.000 --> 00:57:34.320 Wagstaff, Kiri L: Without looking at the exact example might be hard to know what the question is. But 412 00:57:35.400 --> 00:57:44.340 Wagstaff, Kiri L: I will recommend if you want to come to office hours. I'm going to do virtual office hours in two minutes. And we can look at an example. More specifically, 413 00:57:45.450 --> 00:57:46.320 Sho: Okay, thank you. 414 00:57:46.710 --> 00:57:47.640 Wagstaff, Kiri L: Yeah, you're welcome. 415 00:57:49.740 --> 00:57:51.240 Wagstaff, Kiri L: Okay, other final questions. 416 00:57:54.780 --> 00:57:57.810 Wagstaff, Kiri L: tips or advice for CS 162. Oh well. 417 00:58:00.030 --> 00:58:06.840 Wagstaff, Kiri L: So I have not taught one CS 162 so I don't have intimate knowledge of it. Exactly. But I know you have great instructors for it. 418 00:58:07.230 --> 00:58:12.720 Wagstaff, Kiri L: I also have looked at some of the assignments that they they have for that. And I would say that they are 419 00:58:13.080 --> 00:58:22.260 Wagstaff, Kiri L: More lengthy and more demanding than what we've done so far in 161 as you would expect, but they get to introduce you to a lot of new capabilities that we also haven't seen yet. 420 00:58:23.100 --> 00:58:33.540 Wagstaff, Kiri L: Working with files, for example, which we only just touched on, but didn't get to actually do in an assignment and getting more and more sophisticated building your own data structures and so on. 421 00:58:34.560 --> 00:58:38.700 Wagstaff, Kiri L: So you'll get to see a lot more language features in 162 then you have so far. 422 00:58:43.050 --> 00:58:44.310 Wagstaff, Kiri L: Leon about 423 00:58:45.990 --> 00:58:58.860 Wagstaff, Kiri L: The format for classes next term, we are in. We've been told that we need to do everything through online instruction. So most folks are planning to switch to zoom for the lectures. Yes, to answer your question, and 424 00:59:00.960 --> 00:59:06.300 Wagstaff, Kiri L: If you anyone has suggestions for ways to make that more accessible easier to use. 425 00:59:07.830 --> 00:59:13.590 Wagstaff, Kiri L: These easier to read. Easier to interact. We all want to hear your ideas too because we're figuring it out as we go. 426 00:59:14.700 --> 00:59:18.180 Wagstaff, Kiri L: And final question about link list. No, they're not going to be on the final. That's right. 427 00:59:22.890 --> 00:59:29.640 Wagstaff, Kiri L: I do not know about plugins for server Vim. I don't understand the question. Dylan. So maybe you can ask me separately. 428 00:59:30.360 --> 00:59:40.890 Wagstaff, Kiri L: Yes browsing previous 162 websites is a good start. Although the instructor might not be the same as. Whoever created that particular one. So keep that in mind that they do change over time. 429 00:59:44.040 --> 00:59:45.900 Wagstaff, Kiri L: Can you installs. 430 00:59:47.310 --> 00:59:50.370 Wagstaff, Kiri L: I would recommend not trying to modify them. 431 00:59:52.110 --> 01:00:01.050 Wagstaff, Kiri L: But certainly, you can change your Vim RC like we practiced in lab where you can customize it and have syntax highlighting and have all those other features that you might like the best. 432 01:00:04.320 --> 01:00:04.770 Wagstaff, Kiri L: Yeah. 433 01:00:06.330 --> 01:00:11.940 Wagstaff, Kiri L: Okay, I think that's all the time we have. That's probably more than the time we had. I'm going to switch over to 434 01:00:12.720 --> 01:00:27.930 Wagstaff, Kiri L: The Office Hours zoom and you're certainly welcome to come with me there. I'll send an email reminding folks with that link is in case you didn't have it handy. But thank you for joining us for our first virtual class here I'll post about the recording as well. 435 01:00:28.980 --> 01:00:36.870 Wagstaff, Kiri L: Take care of yourself and stay safe and everything I want you all to do really well in this class. And next term. Thanks.