1 00:00:00,680 --> 00:00:05,800 Now let's get started with manipulating several elements in our array here. 2 00:00:05,810 --> 00:00:09,440 So in order to manipulate it, we need to get an index number. 3 00:00:09,440 --> 00:00:15,740 So array two here in this case, array two, the second index is eight seven. 4 00:00:16,130 --> 00:00:22,130 As you can see here, we will make the index of 2 to 50 here. 5 00:00:22,340 --> 00:00:26,300 And also we will also make the. 6 00:00:27,180 --> 00:00:28,950 We will also see that the third array. 7 00:00:29,310 --> 00:00:30,720 So my array. 8 00:00:31,530 --> 00:00:33,270 Uh, the third. 9 00:00:33,660 --> 00:00:35,070 And here, let's make it. 10 00:00:37,470 --> 00:00:38,100 70? 11 00:00:38,140 --> 00:00:38,360 Yes. 12 00:00:38,430 --> 00:00:40,410 75 or 73. 13 00:00:42,130 --> 00:00:43,450 And now. 14 00:00:44,380 --> 00:00:50,800 What we will doing here is that we are deleting here. 15 00:00:53,480 --> 00:01:00,620 And actually after that, let's actually create our code again, write it like that here, see out the 16 00:01:00,620 --> 00:01:02,060 new array elements. 17 00:01:03,230 --> 00:01:05,480 New array elements. 18 00:01:05,510 --> 00:01:06,590 Elements here. 19 00:01:06,590 --> 00:01:08,570 And it's going to be the. 20 00:01:09,240 --> 00:01:10,530 And line. 21 00:01:11,280 --> 00:01:14,280 And we will do we will write the same code. 22 00:01:14,310 --> 00:01:15,330 Again here. 23 00:01:15,330 --> 00:01:19,950 So we will compare this, uh, this race here. 24 00:01:19,950 --> 00:01:21,660 So we will compare. 25 00:01:22,290 --> 00:01:26,850 Uh, the result and output differences between these codes. 26 00:01:26,850 --> 00:01:28,260 So, uh, after manipulating. 27 00:01:28,290 --> 00:01:30,990 Of course, here, after manipulating our code. 28 00:01:31,380 --> 00:01:34,020 So now we're going to here. 29 00:01:39,830 --> 00:01:41,120 So now we're going to. 30 00:01:43,790 --> 00:01:45,170 Paste this code here again. 31 00:01:45,170 --> 00:01:47,810 So these are this is the same output. 32 00:01:49,790 --> 00:01:50,360 Here. 33 00:01:50,480 --> 00:01:51,890 This is the same output. 34 00:01:52,130 --> 00:01:57,070 And here, actually, before running, let's actually let me explain this. 35 00:01:57,080 --> 00:02:04,520 So this code we see that initializing an array is simple and this is the dome by defining the array 36 00:02:04,520 --> 00:02:05,210 data type. 37 00:02:05,210 --> 00:02:09,440 So the arrays name here, race name. 38 00:02:10,300 --> 00:02:11,050 Follow it. 39 00:02:12,310 --> 00:02:16,610 By a couple of score bracelets here. 40 00:02:16,630 --> 00:02:23,240 And as you can see here in this case, it's this the couple of square braces here. 41 00:02:23,260 --> 00:02:26,350 So let's actually let me write it again. 42 00:02:26,350 --> 00:02:33,550 And as you can see here, uh, initializing array is simple and defining the array type is more simpler 43 00:02:33,550 --> 00:02:33,970 here. 44 00:02:33,970 --> 00:02:40,480 So we need in order to access these arrays, we just need to use the array types here. 45 00:02:40,810 --> 00:02:49,630 Let me actually use the width narrower here and a bit narrower to here, so. 46 00:02:50,750 --> 00:02:51,530 So. 47 00:02:52,380 --> 00:02:53,250 In this code. 48 00:02:53,280 --> 00:02:58,050 Our array name is my array that we created here. 49 00:02:58,080 --> 00:02:59,160 My array. 50 00:03:00,220 --> 00:03:09,250 So we can access each element by using its index here, the three, two and etcetera. 51 00:03:10,670 --> 00:03:16,430 So in the code we print each element by iterating. 52 00:03:17,970 --> 00:03:25,950 By iterating and accessing the element value using the array and E here. 53 00:03:25,950 --> 00:03:28,020 So E is incrementing. 54 00:03:28,020 --> 00:03:36,300 So it starts from zero and the second loop goes one, two, three, four. 55 00:03:36,300 --> 00:03:45,240 And after being e being four, we are checking that the size of array is no size of E is no longer less 56 00:03:45,240 --> 00:03:47,840 than our array size. 57 00:03:47,850 --> 00:03:51,210 Then after that we are breaking the loop. 58 00:03:51,210 --> 00:03:57,990 So you learned about loops in previous lectures, so I will not return to the loops again. 59 00:03:58,860 --> 00:04:06,060 But if you don't remember the loops well you can check the previous lectures here and then come again 60 00:04:06,060 --> 00:04:06,720 here. 61 00:04:07,770 --> 00:04:12,270 So let's continue our array here. 62 00:04:15,230 --> 00:04:18,320 So actually, let's delete this using the rubber. 63 00:04:19,320 --> 00:04:21,900 Here now. 64 00:04:24,450 --> 00:04:31,440 Uh, we also manipulate the value of indexes the two and three by using. 65 00:04:31,440 --> 00:04:32,130 Actually, it's. 66 00:04:32,190 --> 00:04:40,230 Yeah, we are manipulating the value of indexes by using the two and three here, as you can see here. 67 00:04:40,350 --> 00:04:44,820 So we are assigning 2 to 50. 68 00:04:44,820 --> 00:04:52,050 So the second index, second index goes to 50 here and actually see that. 69 00:04:52,080 --> 00:04:54,030 So second index here. 70 00:04:54,120 --> 00:04:56,670 The second thing, what's the second index here? 71 00:04:56,700 --> 00:04:57,600 87. 72 00:04:57,600 --> 00:05:02,250 So 87 the index to new value is going to be. 73 00:05:03,780 --> 00:05:04,290 What? 74 00:05:04,290 --> 00:05:05,940 The 50 here? 75 00:05:05,940 --> 00:05:06,630 50. 76 00:05:08,360 --> 00:05:10,680 The new value is 50. 77 00:05:10,700 --> 00:05:14,420 And also we are assigning index 3 to 7. 78 00:05:14,450 --> 00:05:16,480 Actually, it's not like that. 79 00:05:16,490 --> 00:05:24,010 It's it's like here we are assigning 50 to index two, we are assigning 73 to index three. 80 00:05:24,020 --> 00:05:27,470 So in this case it's going to be the index. 81 00:05:27,470 --> 00:05:28,250 Two is going to be. 82 00:05:30,060 --> 00:05:30,840 Here. 83 00:05:31,440 --> 00:05:33,870 Index two is going to be 50. 84 00:05:34,590 --> 00:05:36,690 So this is the new value index. 85 00:05:36,690 --> 00:05:42,660 Two is going to be 50 and index three is going to be. 86 00:05:43,750 --> 00:05:51,340 73 here and index three is going to be 73. 87 00:05:52,450 --> 00:05:54,760 73. 88 00:05:56,970 --> 00:05:57,660 Here. 89 00:05:58,530 --> 00:06:03,750 So, uh, the if a build and run this application, let's, uh. 90 00:06:03,750 --> 00:06:08,670 So this was our previous compilation and the result. 91 00:06:09,360 --> 00:06:10,740 Let's use the earth. 92 00:06:10,770 --> 00:06:12,030 All of this here. 93 00:06:14,630 --> 00:06:17,990 And here, let's run it again. 94 00:06:18,470 --> 00:06:21,230 Compile it again and run it again here. 95 00:06:21,230 --> 00:06:22,940 And as you can see here. 96 00:06:23,680 --> 00:06:25,720 The first element goes like this. 97 00:06:25,930 --> 00:06:26,740 25. 98 00:06:26,770 --> 00:06:27,700 21. 99 00:06:27,730 --> 00:06:28,210 Yes. 100 00:06:28,240 --> 00:06:28,870 Is 21. 101 00:06:28,870 --> 00:06:30,820 We didn't do anything to 21. 102 00:06:30,850 --> 00:06:34,960 The first zero index we have the. 103 00:06:36,260 --> 00:06:41,270 Actually, yeah, we have this 47 and as you can see, it goes the usual. 104 00:06:41,300 --> 00:06:51,950 The was the same with the 21, 20 and 47, 21, 47 And here we also have 87. 105 00:06:52,160 --> 00:06:53,720 This was the previous ones here. 106 00:06:53,720 --> 00:06:55,610 So these are all the same. 107 00:06:58,390 --> 00:06:59,470 This is all the same. 108 00:06:59,470 --> 00:07:05,140 And as you can see here, after that, 87 here is changing. 109 00:07:05,410 --> 00:07:09,670 We are manipulating, uh, the index, uh, the value of our array. 110 00:07:09,670 --> 00:07:12,820 And as you can see, it is seven goes the. 111 00:07:14,610 --> 00:07:15,720 250. 112 00:07:15,750 --> 00:07:19,410 And as you can see here, the new value is 50. 113 00:07:20,460 --> 00:07:21,300 So we don't need that. 114 00:07:21,510 --> 00:07:28,770 And the 6969 here changed its value to 73. 115 00:07:28,770 --> 00:07:32,310 And as you can see here, it's 50 and 73. 116 00:07:32,310 --> 00:07:38,790 And about the 35 here, it's the same again. 117 00:07:38,880 --> 00:07:41,760 So there's an interesting fact about arrays here. 118 00:07:41,760 --> 00:07:45,180 So we can access the arrays element using a pointer. 119 00:07:45,180 --> 00:07:51,210 So as you may know, a pointer is a variable that holds the address instead of the value. 120 00:07:52,000 --> 00:07:52,630 So. 121 00:07:52,630 --> 00:07:59,590 And since we have, uh, learned earlier that each element in array has its own address, as you can 122 00:07:59,590 --> 00:08:00,550 see here. 123 00:08:01,450 --> 00:08:05,500 Uh, we can access each element, each arrays element using its address. 124 00:08:05,650 --> 00:08:10,510 So we can also use the pointer to, uh, as an array. 125 00:08:10,510 --> 00:08:15,280 So we'll, you will learn this in next lecture. 126 00:08:15,280 --> 00:08:15,990 So I'm waiting you in. 127 00:08:16,010 --> 00:08:16,510 Next lecture.