Signs were covering the use of variables.
It's worth explaining the syntax used to define pointers and arrays because there are some potential
pitfalls.
So working with memory arrays and pointers covers in the in next lectures in more detail.
So we will just introduce this syntax so that you are familiar with it.
So in C plus plus you will access memory used a typed pointer.
So the type indicates the type of the data that is held in the memory that is pointed to.
So if the pointer is an four byte integer pointer, it will point to four bytes that can be used as
an integer.
If the integer pointer is incremented, then it will point to the next four bytes which can be used
as an integer.
So in C plus plus pointers are declared using the asterisk here.
Asterisk.
Using this asterisk symbol and you access a memory address with this and operand.
So let's create a pointer P here, integer E 52 and P equals and operator and a symbol here.
And so now I want to explain and comment these lines so you can when you download these codes, you
got understanding of what these lines means.
So the first line declares a variable P, which will be used will be used to hold the memory address
of an integer.
So the next one here.
Um.
The second line declares an integer, declare declares and an integer and signs value.
As you remember, this is just a usual usual thing that how we declare the integer values here?
Nothing strange here.
Nothing new here for, uh.
For us.
Here and here.
As you can see, we used the and operator.
So this.
And operator.
The third line assigns a value.
Assigns a value.
So this assigns a value to the pointer P here.
Uh, to be the address.
Of the integer.
Variable.
Here.
So it's important to stress that the value of P is not 52.
It will be a memory address where the value of 52 is stored.
So note how the declaration has the asterisk here on the variable name.
This is a common convention that the reason is that if you declare a several variables on in one statement,
the asterisk here applies only to the immediate variables.
So for example, let's create an integer, uh, integer P1, p2, P3 here.
So as you can see here, this is the example of this is a common convention.
The reason is that if you declare a several variables in one statement, this asterisk applies only
to the immediate immediate variable.
And let's create another example of the declaring pointer types here.
So this looks like you're declaring here as you as you can see, let's make here integer.
This will look like you are declaring two integer pointers.
However, this line does not do this here.
Um.
Integer P1.
An integer P two.
Actually, we did the P one integer.
S one.
Integer S2.
Here.
So.
As you can see.
See here?
Um.
This line does not do this.
As you can see, we have three pointers here, pointer, two types here.
And this line does not do this, does this because the second variable is an integer called P called
S2 and it declares just one pointer called the integer called S1 integer pointer here.
And if you wish to declare the two integers in one statement, then you should do as follows.
Here.
P1 and.
T1 and.
T two.
So this is the correct one if you want if you want to declare two pointers to pointer types here.