WEBVTT

00:00.680 --> 00:05.800
Now let's get started with manipulating several elements in our array here.

00:05.810 --> 00:09.440
So in order to manipulate it, we need to get an index number.

00:09.440 --> 00:15.740
So array two here in this case, array two, the second index is eight seven.

00:16.130 --> 00:22.130
As you can see here, we will make the index of 2 to 50 here.

00:22.340 --> 00:26.300
And also we will also make the.

00:27.180 --> 00:28.950
We will also see that the third array.

00:29.310 --> 00:30.720
So my array.

00:31.530 --> 00:33.270
Uh, the third.

00:33.660 --> 00:35.070
And here, let's make it.

00:37.470 --> 00:38.100
70?

00:38.140 --> 00:38.360
Yes.

00:38.430 --> 00:40.410
75 or 73.

00:42.130 --> 00:43.450
And now.

00:44.380 --> 00:50.800
What we will doing here is that we are deleting here.

00:53.480 --> 01:00.620
And actually after that, let's actually create our code again, write it like that here, see out the

01:00.620 --> 01:02.060
new array elements.

01:03.230 --> 01:05.480
New array elements.

01:05.510 --> 01:06.590
Elements here.

01:06.590 --> 01:08.570
And it's going to be the.

01:09.240 --> 01:10.530
And line.

01:11.280 --> 01:14.280
And we will do we will write the same code.

01:14.310 --> 01:15.330
Again here.

01:15.330 --> 01:19.950
So we will compare this, uh, this race here.

01:19.950 --> 01:21.660
So we will compare.

01:22.290 --> 01:26.850
Uh, the result and output differences between these codes.

01:26.850 --> 01:28.260
So, uh, after manipulating.

01:28.290 --> 01:30.990
Of course, here, after manipulating our code.

01:31.380 --> 01:34.020
So now we're going to here.

01:39.830 --> 01:41.120
So now we're going to.

01:43.790 --> 01:45.170
Paste this code here again.

01:45.170 --> 01:47.810
So these are this is the same output.

01:49.790 --> 01:50.360
Here.

01:50.480 --> 01:51.890
This is the same output.

01:52.130 --> 01:57.070
And here, actually, before running, let's actually let me explain this.

01:57.080 --> 02:04.520
So this code we see that initializing an array is simple and this is the dome by defining the array

02:04.520 --> 02:05.210
data type.

02:05.210 --> 02:09.440
So the arrays name here, race name.

02:10.300 --> 02:11.050
Follow it.

02:12.310 --> 02:16.610
By a couple of score bracelets here.

02:16.630 --> 02:23.240
And as you can see here in this case, it's this the couple of square braces here.

02:23.260 --> 02:26.350
So let's actually let me write it again.

02:26.350 --> 02:33.550
And as you can see here, uh, initializing array is simple and defining the array type is more simpler

02:33.550 --> 02:33.970
here.

02:33.970 --> 02:40.480
So we need in order to access these arrays, we just need to use the array types here.

02:40.810 --> 02:49.630
Let me actually use the width narrower here and a bit narrower to here, so.

02:50.750 --> 02:51.530
So.

02:52.380 --> 02:53.250
In this code.

02:53.280 --> 02:58.050
Our array name is my array that we created here.

02:58.080 --> 02:59.160
My array.

03:00.220 --> 03:09.250
So we can access each element by using its index here, the three, two and etcetera.

03:10.670 --> 03:16.430
So in the code we print each element by iterating.

03:17.970 --> 03:25.950
By iterating and accessing the element value using the array and E here.

03:25.950 --> 03:28.020
So E is incrementing.

03:28.020 --> 03:36.300
So it starts from zero and the second loop goes one, two, three, four.

03:36.300 --> 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

03:45.240 --> 03:47.840
than our array size.

03:47.850 --> 03:51.210
Then after that we are breaking the loop.

03:51.210 --> 03:57.990
So you learned about loops in previous lectures, so I will not return to the loops again.

03:58.860 --> 04:06.060
But if you don't remember the loops well you can check the previous lectures here and then come again

04:06.060 --> 04:06.720
here.

04:07.770 --> 04:12.270
So let's continue our array here.

04:15.230 --> 04:18.320
So actually, let's delete this using the rubber.

04:19.320 --> 04:21.900
Here now.

04:24.450 --> 04:31.440
Uh, we also manipulate the value of indexes the two and three by using.

04:31.440 --> 04:32.130
Actually, it's.

04:32.190 --> 04:40.230
Yeah, we are manipulating the value of indexes by using the two and three here, as you can see here.

04:40.350 --> 04:44.820
So we are assigning 2 to 50.

04:44.820 --> 04:52.050
So the second index, second index goes to 50 here and actually see that.

04:52.080 --> 04:54.030
So second index here.

04:54.120 --> 04:56.670
The second thing, what's the second index here?

04:56.700 --> 04:57.600
87.

04:57.600 --> 05:02.250
So 87 the index to new value is going to be.

05:03.780 --> 05:04.290
What?

05:04.290 --> 05:05.940
The 50 here?

05:05.940 --> 05:06.630
50.

05:08.360 --> 05:10.680
The new value is 50.

05:10.700 --> 05:14.420
And also we are assigning index 3 to 7.

05:14.450 --> 05:16.480
Actually, it's not like that.

05:16.490 --> 05:24.010
It's it's like here we are assigning 50 to index two, we are assigning 73 to index three.

05:24.020 --> 05:27.470
So in this case it's going to be the index.

05:27.470 --> 05:28.250
Two is going to be.

05:30.060 --> 05:30.840
Here.

05:31.440 --> 05:33.870
Index two is going to be 50.

05:34.590 --> 05:36.690
So this is the new value index.

05:36.690 --> 05:42.660
Two is going to be 50 and index three is going to be.

05:43.750 --> 05:51.340
73 here and index three is going to be 73.

05:52.450 --> 05:54.760
73.

05:56.970 --> 05:57.660
Here.

05:58.530 --> 06:03.750
So, uh, the if a build and run this application, let's, uh.

06:03.750 --> 06:08.670
So this was our previous compilation and the result.

06:09.360 --> 06:10.740
Let's use the earth.

06:10.770 --> 06:12.030
All of this here.

06:14.630 --> 06:17.990
And here, let's run it again.

06:18.470 --> 06:21.230
Compile it again and run it again here.

06:21.230 --> 06:22.940
And as you can see here.

06:23.680 --> 06:25.720
The first element goes like this.

06:25.930 --> 06:26.740
25.

06:26.770 --> 06:27.700
21.

06:27.730 --> 06:28.210
Yes.

06:28.240 --> 06:28.870
Is 21.

06:28.870 --> 06:30.820
We didn't do anything to 21.

06:30.850 --> 06:34.960
The first zero index we have the.

06:36.260 --> 06:41.270
Actually, yeah, we have this 47 and as you can see, it goes the usual.

06:41.300 --> 06:51.950
The was the same with the 21, 20 and 47, 21, 47 And here we also have 87.

06:52.160 --> 06:53.720
This was the previous ones here.

06:53.720 --> 06:55.610
So these are all the same.

06:58.390 --> 06:59.470
This is all the same.

06:59.470 --> 07:05.140
And as you can see here, after that, 87 here is changing.

07:05.410 --> 07:09.670
We are manipulating, uh, the index, uh, the value of our array.

07:09.670 --> 07:12.820
And as you can see, it is seven goes the.

07:14.610 --> 07:15.720
250.

07:15.750 --> 07:19.410
And as you can see here, the new value is 50.

07:20.460 --> 07:21.300
So we don't need that.

07:21.510 --> 07:28.770
And the 6969 here changed its value to 73.

07:28.770 --> 07:32.310
And as you can see here, it's 50 and 73.

07:32.310 --> 07:38.790
And about the 35 here, it's the same again.

07:38.880 --> 07:41.760
So there's an interesting fact about arrays here.

07:41.760 --> 07:45.180
So we can access the arrays element using a pointer.

07:45.180 --> 07:51.210
So as you may know, a pointer is a variable that holds the address instead of the value.

07:52.000 --> 07:52.630
So.

07:52.630 --> 07:59.590
And since we have, uh, learned earlier that each element in array has its own address, as you can

07:59.590 --> 08:00.550
see here.

08:01.450 --> 08:05.500
Uh, we can access each element, each arrays element using its address.

08:05.650 --> 08:10.510
So we can also use the pointer to, uh, as an array.

08:10.510 --> 08:15.280
So we'll, you will learn this in next lecture.

08:15.280 --> 08:15.990
So I'm waiting you in.

08:16.010 --> 08:16.510
Next lecture.
