You can either have typed pointers or a void pointer here.
So the typed pointers will access the memory as if it's specified type to use If you cast a pointer
to a different type and the reference ID, the memory will be treated as containing the cast type.
It really makes sense to do this, but the void pointer cannot bear the reference, so you can never
access data through the void pointer.
So to exit the data you have to cast the pointer here.
The full reason for this void pointer type is that it can point to anything in general.
Void pointer should only be used when the type does not matter to that function.
So for example, the c malloc function returns the void pointer because the function merely allocates
memory.
It does not care what the memory will be used for.
So here pointers also can declare it as a cost here.
So which depending on where you apply, it means that the memory the pointer points to is read only
through the pointer or the value of the pointer is read only.
So now I want to create some character.
Consider this.
We're going to make a character pizza cost here.
So hello And then pointer.
See here.
H.
Here.
And const.
Character Pizzey here.
See, I'm going to comment about all of this.
So for more understanding here and make it look nice and Pizzey.
We hear.
And.
Character.
Closed.
Skippy.
And make it see.
And c p calls e on the underscore e here and C++ or C++ actually, because we're going to use this C++.
So now the C can be used as pointer.
C can be used as a pointer.
And here it's okay to write like that.
Okay.
But can write.
Where I threw the pointer.
Here and here.
As you can see, we declared, and we're going to convert the pointer pointer pointer to constant.
And here.
It's okay, too.
And it can read the memory.
Memory pointed to here.
But here, as you can see here, the ID showed us an error because we cannot write to the memory.
And here it's okay because it's constant pointer.
We're going to create a new constant pointer here.
Constant pointer.
And here we are.
We can write.
We can write true the pointer.
And we cannot point it here.
This C++.
We cannot point to anything else.
Anything else?
So here the PTC is a pointer to a constant connector that is the output you can change the PTC points
to and you can read what it points to, but you cannot use it to change the memory here.
So on the other hand, the c, p here, c p here.
The CP is a constant pointer.
So which means you can both read and write the memory which the pointer points to, but you cannot change
the word it points to.
So it is typical to pass the constant character pointers to functions because the functions do not know
where the string has been allocated or the size of the buffer here.
So the caller may pass a literal which can not be changed, but not that there is not no const operator.
So character const is treated as const character and a pointer to a constant buffer here.
So you can make pointer constant change it or remove it using casts.
And now we're going to create another code here.
Here.
We're going to let's make let's comment this out and make new here.
So here, character, see?
And hello.
And here character points are constant.
Step one, see here.
And we're going to add comments after we complete our code.
Here.
And cast character Patsy.
And cost costs.
We're going to use cost cost here.
Caused cast.
Post character.
And C.P. one.
And here Pizzey Plus plus.
And after that character concept to coast to coast cast and character post here.
And.
P.
C.
And lastly, RCP to.
A.
Here.
So.
You can make a point that constant change it or remove it by using the casts here.
And this code here does some fairly pointless changing around the const keyboard to prove the point.
So the pointer see p one here.
cp1 and cp2.
Can be used to change the memory they point to.
But once signed, neither can point to other memory here.
So the first concept cast here, as you can see, a cast cast here cast away the const ness to a pointer
that can be changed to point to other memory here, but cannot be used to alter that memory.
So the memory in this case, it's pizza here.
So the second cast casts away the closeness of pizza here so that the memory can be changed through
the pointer.
See P to.