Hi, everyone.
Welcome back to the cause.
So today we will learn a new concept called appointers.
So Boynton's is a very interesting topic.
So let's start.
And I question.
So what will happen?
I will get food by itself.
Memory Speace.
Dan is stored here now in the next line.
If I try and print the value of I so want to live my output, my output will be 10.
But how a system knows Veis, actually, I stood.
Any guesses?
So we have something called Simbel Table.
The symbol table is generated by a compiler at the completion time.
So symbol table is actually a map.
It will store.
There is a variable fly and the variable eye has got a memory base of 700.
So this has a memory address of seven ended.
So when I am printing the value of I, what will happen?
The compiler will search I in the symbol table.
Yes, there is a variable.
I and the variable I is present at memory address seven ended.
So I will go to I mean sys system will go to seven hundred and it will print ten.
OK.
So as soon as you create a variable, for example, Entergy, the variable G has to make an entry into
Simbel Table.
Suppose the addresses 794.
Similarly, if you create an either variable galaxy, so she will make an entry in decimal table, suppose
that does is it ended?
OK.
So as soon as you create a variable, that variable has to make an entry in the symbol table.
Now, symbol table stored many information.
For example, it will store the name of the variable and the memory address apart from it.
It will also store.
What is the type.
Suppose I of integer and it will also store like what is the scope of I and many other informations.
OK.
So now what I want is I want to print this address.
Seven hundred.
I want to know veis actually I stored.
I want to print its address.
So we have something called address of Operator.
So address off I.
So if we will write C out address ofay I will get this address.
Seven entered.
OK.
So let's see.
So I have a myriad of file pointers in product CPB.
Now I have a variable.
And day it goes down.
Now let us spend the I.
So she yelled at myself.
I.
So this is the memo that herself off I so if you remember, I have already told you that the this is
stored in hexadecimal Lemba system.
So this is in hexadecimal.
No system.
Now, what I more know is so now I want to store address off I.
So we need a data type that was stored at this off.
I.
So it gad flawed.
Any of these three gone to the address of a very.
So we have something called pointers.
So at this point, the point is actually a variable that will store the address of other variables.
So a variable that will store.
Address of the variables.
This is the standard definition of a point.
OK, so Blinda.
B equals.
And percent of I.
So point B, B is A pointer that will store the address of I.
OK.
So this is actually wrong.
We can't write like this.
I would tell you in very short time why this is wrong.
So suppose B's containing 700, so P is containing 700.
So this is my variability.
This is variable rarely addresses.
So it ended and value is ten.
So be is storing 700.
That means I can access 10 from here.
OK, so what I want know is go to memory or does it say 100 and tell me what is it there?
OK.
So what I want now is go to memory or does seven.
And tell me what is written there.
So can you tell me the answer is you can't my.
Because you don't know how many bites to read.
This is so unhindered, so a when so under two and seven under three.
So one bite, one bite, one bite and one bite.
And suppose the number is so this is my number and memory.
So it ended.
So I want to go to memory of this 700.
And tell me what is written there.
And I am telling you that you can't answer this question.
Why?
Because you don't know how many bites to read.
So suppose I told you somehow you got to know that we have to read for Bite's.
OK.
So as you somehow we got to know that we have to do it for right now, can you tell me how to intubate
those four bites?
What I want to say is, suppose I give you four bites.
Now, tell me the meaning of this photo by its.
You can tell why.
Because these four bites might be representing four different characters.
These four bites might be one fluid.
These four bites might be representing half size of a double half size of a double.
Basically, I give you first four bites, first four bites of eight by.
So these four bites can be anything.
So we are facing two difficulties here with the help of this representation, with the help of point
thirty to type.
And there are two difficulties are first, I don't know how many bites to read.
Second, if I know that I have to root for bites, then I don't know how to interpret those four bites.
Those four bites might be four characters when fluid half size over the bowl.
Basically anything.
So there are two difficulties in this representation.
Hence, this representation is wrong.
OK.
So when we write for into B equals M percent Towfigh.
So once I have the address of I in point B in the next lane, there is no way for me to see what is
exactly stored at memory at this seven hundred.
That information is just not available to me.
OK, so how do we create pointers?
So we create pointers like this.
Now, how do read this line?
B is a pointer pointing to an integer.
So we will read from right to left.
One more time.
B is a pointer pointing to an integer.
Now this all votes the problem.
So the first problem was, I don't know how many bytes to read.
So how many bytes?
To read.
Now I know how many bikes read because I have it here, so I know that I will go to memory at this seven
ended and I will read for Bite's.
Seven zero three and seven zero one and seven zero two.
So the first problem is solved because of this in Beja.
So I wouldn't go to memory this I attended and I will read forward by it because in BGA is up for debate.
Now, the second problem was how to interpret those bytes, how to interpret.
And this problem is also soiled because now I know that it is ending, T.J..
So I will interpret this for bites as an integer.
Now, both the problems are solved with this representation.
So this representation is much, much better.
And we will represent our pointers and we will make pointers using this approach.
So the above approach, this approach is never used.
OK, so let's see.
So I have a point B, which is pointing to anybody here at least, or at this off I.
Now let us try to print the value of P.
So virtually my output, basically, Addazio, Fi and B bothof seem.
So you can see here.
Output of board and personal air doesn't fly and be both the same.
OK, so memory addresses seem.
Now, let us learn something more interesting.
So let us talk about size of appointer, basically the size of appointer is fixed.
So if you have a pointer which is containing that dustoff, an integer.
So and I and you also have a pointer which will store that does have a character.
So Canstar, let's say P2 is storing that dustoff.
See, now, if I will bend the size of B and if I will try and print the size of B2, both output will
be same size of both.
The point does not seem if you will print the size of I.
I will get forward by it because integer is of four.
Right.
And if you will print the size of C, you will get one byte.
Martin, case of point does size will be seen.
Let's see.
Now, let us create a character pointer.
So Gastar, let's see.
BE2 is distorting the address of variable C.
So the output of this line and the output of this line will be same.
Let's see.
So basically, four bites and four bites.
So let me give and line here.
So the size of I integer pointer is forward.
And size of a connector pointer is also forward.
Even though the size of India was four bites and the size of a character is one bite, but the size
of the point that is seem.
Now, let us try to understand why this happened.
Suppose days, a 200 square yard house.
So this is a small house, let's call it get.
And we have 800 screamy art house.
Let Scollard and.
Now, let us talk about their addresses.
So if this house is big and this houses small, that doesn't mean that this house address will be very
long and this house address will be very small.
The address is of both.
The houses will be very similar.
OK.
So basically when we arrived and Star B equals and by Santa Fe, I just have to store the starting address.
So be restored.
700.
Similarly, if you have a pointer, Gastar C equals M percent of C, so C will store just this starting
at this later there.
This is seven nine.
Before we just have to store the starting address.
That's why the size of the point that is fixed and can and this simple analogy will help you to understand
it better.
If a house is very big, that doesn't mean it's a dress will also be very big there.
This will be compatible.
That's why the size of the pointer is fixed in my system.
It is four bytes.
So this vary from compiler to compiler and from system to system.
So this is it for this video.
If you have any doubt, feel free to ask.
I will see you the next one.
Thank you.