Hey, guys, what's up?
So today we are going to learn a very important topic called Eddie.
So first, there doesn't understand.
Where does it end?
And why do we need it?
For example, there's a class in a class.
There are supposed there are hundreds students.
And your aim is to store the marks of each and every student.
So what we will do, we will create hundred variables, for example, and marks off first student,
similarly marks of second student and so on.
Dale Marks off handed.
Student.
OK.
So you will get 200 variables to store marks off under Turin's.
But if we are having let's say, suppose thousands friend, you will have to create a thousand variables
to St. Marks of each and every student.
So is this approach good?
No, this is very inefficient.
OK.
So when we have made the variable, then also when you will fill it out, you will you'll have to write
marks on.
It equals 90 marks to it, cause 95 and so on.
So this approach is very inefficient.
OK.
So what we can do is we can use entity.
So what is an array?
So normally when we write in a when right into what will happen, we will get four by itself, mamady
space.
We will get one box and this box is of four bytes.
But when you will ride into a 16.
So what will happen?
You will get 16 boxes.
You will get 16 boxes each of size, four bytes, 16 boxes, each of size, four bytes.
And the numbering in the area does not start from one, it will start from zero, so zero then one then
to 14 and 15.
OK, numbering it starts from zero.
That's why the last number will be fifteen.
So if I'm making a variable of size, if I'm making an array of size n so starting will be always be
zero and counting always starts on zero.
And next.
List start some deal.
So this will be zero and the last position will be N minus one.
Okay.
Now, once you get an idea, what we can do is, for example, you want to store.
So if one equals two.
So what will happen?
I will go to first operation and I will write to here.
You want to write it off five equals seven.
So it will happen.
You will go to fifth operation.
Suppose it is five and you will write seven hit.
So this Eddie can solve our problem.
How do you do?
We will, right?
And marks off Henderson's will make an it also, isn't it?
So what will happen?
This would be my Eddie.
Last week, be 99 and starting will be zero.
OK, so in just one step, I have created hundred of it.
He was.
And I can easily use them, for example, marks of forced to student.
Is.
Ninety.
So I will ride 90 hit marks off and that student under does not under doesn't exist myself.
And that student.
So the this it will be 99.
OK.
Because numbering staff, some zero sum also fun disappearances and it's a hundred.
So I will write under here.
OK.
So with the help of fetti we can create many variables at the same time.
And what will happen this, this allocation will be contiguous.
OK.
You will get boxes in a contiguous way.
You will not get boxes, you like one box here, one box here, one box here, one box, sir.
And these are not connected.
OK, so this will not happen.
This will happen.
You will get memory contiguously.
OK.
One more thing, if I have made, for example, Lindsay and Eddie of size 10.
So you have made an eddy of size 10 start the first index zero last year, index nine.
OK, so you have made indigenously.
You can write integer here, OK?
You cannot write character here or float here.
Why?
Because you have made in digital array of integers.
Similarly, we can also make it clear that a cat.
A letter.
So it will happen.
I will get 10 boxes.
Zero and nine.
And each of size of one bite because one character is up, one bite.
And in one box, I will store one character.
OK.
I cannot store of flawed or in.
That is wrong because we have made out of characters.
OK, so let's see how we can initialize our Eddie.
So first, let us make it a.
Let's name this file as.
Adding to.
Nazi, EPB.
So when we ride this into, a word will happen.
I will get four by itself, Mamadu Speace.
But when we write and a offsides, let's say 10.
What will happen?
I will get 10 boxes in a contiguous contiguously in a contiguous manner, each of size, four bites
each box will contain one indigene.
Now, let us fill some value.
For example, if a zero equals to a of let's say, four equals five.
And let us bend those values, one to see out.
Of Zito, similar Lenat I spent a fortune to see out of four.
OK, so let us run our programs, our approach should be l zero values to a four values five.
So my approach would be to in five.
So I put this to one five.
Now let's see how we can initialize our area.
Suppose I make an eddy of size.
Let's say forward.
I will write like this one, two, three and four.
So this is the way off initializing the idea.
And footprinting that way, Lou.
What I will do, I will write C out of zero.
C out of one, C out of two and C out of three.
OK.
And line right way from zero to three.
Because I told you that numbering in that it will always start from zero.
And you have if you have made it at eight size four.
So last will be three.
So this is zero.
This is one, this is two and the history, the moment.
OK, so this is my ATIC.
This is my area.
And a four will careered this.
And I am storing one, then two, then three and then four, and then I am printing a zero one of one,
two, eight, two, three, and they have three years food.
So let's print it out.
No wonder desk comment all this.
So I have to make an area of size.
Poor and the values are.
When I do commentary for.
So these are my values and I will bend any so footprinting that I will do.
I will bend all the way loose.
So I see out of zero.
See out of one.
Similarly, Lisa, out of two and a half, three.
So in this way, we can bend it at it.
So what we are doing, we will go to every politician and really brand new store in that position.
Simple.
I'm giving spaces between each and every value.
So this is all that we have to do for initializing that.
So this is called initialization.
We have initialized the values of Eddie.
So this is initialization.
And here we are printing the release of the edit.
So printing printing values.
So you get to see my output is one, two, three and four.
OK.
Now, I suppose if I make an error of size, then I'm only giving for the lose.
So what I'm trying to say, in the previous case, I made an error in all size food and I give values
one, two, three and four.
Now, what I'm trying to do.
I am making an area of size 10 and I am giving only four values.
I'm giving four values.
So what will happen?
So venue will print all the venues.
What will happen?
So we will be starting from a zero then in nine.
So what happened is when reinitialize, Eddie?
When we initialise.
At a rest of the position, rest of the position becomes zero.
OK, so just one second.
First first, let us optimize this.
So this way of printing is very bad.
OK, so suppose if you have had it, if you have an add it all size, let's say thousand, will you
write like this CO2 of zero eight one, two, three, four.
No, this is very inefficient.
So what you can do here is suppose that the size of forward we will use a loop.
So for the first position is zero.
So and equals zero.
And the last position is.
And minus one.
So right from equals zero then I use less than n.
I bless, bless what I have to do.
I have to print the values off that.
Or C I would.
They all fight.
So this is much a better way of bringing the values of Eddie.
OK, so listen, desperate for this also.
Forward antiquity, Roy Liston and.
I is less than OK, so endless.
We have not used them.
We have used for the size of the ad is for.
So one, two, three, four is getting blended.
So what I'm doing here is so what I'm doing here is what is the meaning of this line?
Make four boxes.
This is zero, one, two and three, and the venues are one, two, three and four.
So what this will loop is doing?
It starts from zero.
So start from zero.
Well, I is less than four.
That is then I Delie is less than close to three Brindabellas.
Out of I.
So it will see out of zero then.
CEO Dave.
When does the idea of do and then the order of three.
OK.
So this is much better way of printing the values of the attic.
Now, what I was trying to do is what if I make an ideal size 10?
So I told you if we the Eddie arrest of deportation, rest of the potion becomes a zero.
So what is the meaning of this?
So the meaning is very clear.
What will happen?
The first Ford position.
Zero, one, two and three to which I have given value.
It will become one, two, three and four.
And rest.
All the politician will become zero zero zero zero.
So this is the story.
Zero zero zero fourth and fifth equation.
Sixth equation.
And similarly, the last position for areal size 10 is nine.
So it will also be zero.
So when you initialize, the rest of the position will become zero.
So one, two, three, four will be there and rest all and will become zero.
So that is tested.
So we have made an ideal system and the values.
I have only two and four values.
Now let us be the area.
So from my goal zero I listed 10 I plus plus ACMD of.
So you can see here, one, two, three, four.
These values we have given the rest, all the six values have become two.
OK.
So, for example, you have given only one venue.
I I'm giving only one venue one.
So what will happen?
When will get bantered?
Rest all patient.
We reached zero.
Let's see.
You can see here arrest oil pollution of the area becomes zero when we initialize the A, similarly,
if you initialize the area with zero, then also it will happen.
So first value we have made zero.
Is total value will become to.
So again, see.
Zero zero zero zero zero.
So this zero is made by us.
And this arrest of the nine best minds, it was made by the property of the Eddie.
Now let's see some more things.
So I'm commenting it out.
So what will happen?
For example, I have made an Eddie, let's say, a size 10.
And now I am printing the.
So, Ford, let us bring this forward and I it goes to zero I elastin.
Sorry I lost and then I lost purse.
See you out of I.
So what would be my output.
Any guesses?
Any idea where w my output?
So let's see.
So 10 millions are getting printed, and all this time we lose.
I got to be Israelis.
OK.
So just like so when we used to write and a and then if we tried to print it.
So what will be printed.
I've got to Israel.
Luke will be printer.
Same happens with this also.
So you have made an area of size 10.
So this is zero.
And this is nine.
So what will happen?
All these boxes will contain garbage.
All boxes will contain garbage.
And the garbage vendors are getting printer.
OK.
OK, so let us do one more thing.
So here.
So instead of bringing the right of Israel, first of all, let us fill the area with values.
So suppose.
So what?
So what do you do?
First, we will fill the value of Eddie.
So if I was let's say I multiply by, so I am feeling daddy.
And then I am bending the value.
So this is correct.
So where to now output.
Let's see.
So.
I am going from politician number zero till politician number nine.
So this is potion number zero.
This is number nine and I is trading from zero to nine.
So what I'm doing, if I equals, I multiply by when I equals zero.
Initially, that equals zero.
So it offers zero equals zero multiplied by zero.
So I will store zero here.
It of one equals one multiplied by one.
So I will store one here, it off two.
It was two multiplied by two.
So I will store four here.
A off three.
It was two multiplied by three.
So I will store nine here.
Similarly eight of eight.
It was eight multiplied by eight.
Sixty four.
So at its position I will store 64.
And similarly at the nine position I will store it one.
So now it will be this zero.
Then one.
Then for the nine.
Eighty one.
So let's see.
So there doesn't not program.
OK, so you can see zero, then one, then four nine eight seven.
So why I'm not getting our major news because first we have those.
We have filled those boxes.
So I will not get garbage values.
OK.
Now, one more thing.
Can we write like this in a can you make any like this?
OK, can we make a like this?
So let us in our programs to see whether this is correct or not.
So this is an art.
Correct.
OK, so that means.
When you want to create today, you have to give the size of that.
For example, you want to create the ideal size 16.
That is 16 boxes.
So you have to view size.
You cannot ride into a.
So this is wrong.
You have to give size.
Sighs Okay.
So it is mandatory to give.
How many number of boxes you want.
Now, let's see, even lasting.
See out and line.
So suppose I have an variable B?
So when I see out.
When we try and bend the size of.
So when we try and bend size of B..
So what will be my output.
Where the low output Y will be.
That size.
That variable B is of four.
Right.
Some are probably before.
Some parties coming out to be for.
Now, let us do the same thing with the area.
Let us try to print size of the area.
So, for example, I have an array of size 10 and what I'm doing.
I'm only giving three way loose.
So one, two and three.
So what volume output?
If I tried to print the size of it.
So we've already made it.
So let's make it be.
And similarly, let's make it the.
So what do do my output.
So there are two options.
There are two possibilities that would have happened here.
And what are those possibilities?
So the size of the.
So the first possibilities, my output as well.
Right.
Second possibilities.
My output is 40 bytes.
Because we have given only three vendors and each value is an integer.
That is four bytes.
So four multiplied by three.
You will get second possibilities for debate life four debates because we have written into the ten.
So this means create 10 boxes, create 10 boxes and each box is an integer.
So each box is containing four by itself, memory space.
And there are ten such boxes.
So four in 10 is 40.
So let's see what the new output, 40 or twenty.
OK.
So now our this coming out to be 40.
And it was obvious also, you have made 10 boxes each of size, each box is an integer, hence each
box is a size four bite.
And there are ten sets of boxes.
So size of added, these will be 40.
OK.
OK, guys.
So this is it for this video.
Thank you.