Hello and welcome to the goal and programming language course.
In the previous session, we talked about declaration and initialization of pointers in this session.
We want to talk about the others pointers concept.
Neil, pointers in goo goo compiler assign initial value to a pointer very bad in case you don't have
exact address to be assigned.
This is done at the time of variable declaration, a pointer that is assigned Neal is called in need
of pointer.
The need point there is a constant with a value of zero defined in several standard libraries to check
for a need point where you can use and if a statement as follows.
Now go to this code and illustrate how to declaring Neil pointers.
First, define the point of a variable valve p star and now do the following code for check need or
not.
If
P equals, he calls mean
so display the message if if the value of B is first x lowercase back is less and and.
He.
He the quote, save the project and execute the program.
Now we can see the output, the value of P is zero.
On most of the operating systems, programs are not permitted to access memory at address zero because
that memory is reserved by the operating system.
However, the memorial address zero has a special significance.
It signals that the pointer is not intended to point to an accessible memory location, but by convention.
If a pointer contains the needle or zero value, it is assumed to point to nothing.
Now go to your slides and continue.
Changing Poland to a value, you can also change the value of the to or the memory location instead
of assigning annual value to the value of it.
Now go to this good program to illustrate the above mentioned concept.
First, clear, the last court.
And save the project.
It's ready to write code.
First, create a variable using vata keyboard, and we are not defining any type of value, but for
the example, via a equals 458.
Now taking a point Revathi been using via Ward without specifying the type that P equals.
Signed a value that.
Display value of every bit and avarice of every bit and pawn in therapy before changing.
FP value stored in a variable equals a go to the next time.
FP.
Address a rally there, he calls Anderson a.
And go to the next line if P value stored in pointer.
T equals and set the value of the P here before the code and say the project now using Asterix or Create
will be for points are very able to access.
The value is stored at the very well at which is it is pointing now write the code if P value.
It's taught in.
Star P before changing, he calls the star P.
Save the project, go to terminal and execute the program until here.
Now we can see the output value soared in a able equals 458 address of a variable and value a sort in
point or p r, the hexadecimal format and value is stored in Astra's before changing equals 458.
Now go to code and change value off point or go to the next line.
Changing the value of a variable by assigning the new value to the pointer is star p equals for the
example five hundred and go to the next line and again display.
The value is stored in asterisks p if p value is stored in star b after changing.
Equals and set the variable a reformat, the quote saved the project and go terminal and execute again.
Now we can see the output value restored in this star after changing equals five hundred.
In this example, the first define a very bad and initialize it, then put the address of that variable
inside and pointer.
Now, by changing the pointer value, we will see that the value inside the initial variable also changes.
In order not to prolong the time of decision, we will finish it and we will continue the content in
the next session.
Goodbye.