The Konski word doesn't just apply to normal variables.
You can also use it with pointers and references.
So for example you'd have a pointer to an integer constant like this since say x x 5 and you like something
like this star will say X don't dare calls to X like that.
OK so x pointer points to x.
Now however it can't change the value of x K.
So I can't do something like this
anymore.
Even if we try right it says error read only variable is not assignable So go as read only now.
That means.
So while I can't change the value of what it wants to I can change where it points to.
So I could do something like this.
And why.
And I can do this calls to my.
So that worked.
In fact if I print out the value X pointer value is
ptr
to 50.
Right.
So it's the Y variable.
Now
so and of course I can't change that y variable the variables value.
I can do the complete opposite as well and create a pointer that can change the value but it points
do but not change where points so I can do something like this.
Come in.
Store say Conte's here.
And I'll say Why enter K will give it y it's this.
Now
so if I try to change where y pointer points to
that
try this.
So there you go.
It doesn't I can't change to where it points to
some numbers here that I must set something on on the on the pointer.
So right here I have to set up this here.
And notice also that I can change the value of.
Y going to air.
I mean that's a fire and that's it works.
Doesn't complain to me.
OK.
So we call this a constant pointer.
This one here is effectively like a reference.
In fact it can change what if it can't change what it points to but it can change the value of what
it points to and it is complete opposite of this which can't change the value that it points to but
it can change where points to.
So I always try to read these from left or right to left because that kind of helps me understand how
it works.
So this one is a pointer to an integer constant k and this one is a constant to a pointer that has type
integer k so this is a constant pointer to an integer.
So like I said before the references are basically constant pointers.
So you could do something like this.
Streff
goes to X this ERPs X that k means I can't change where it points to or change its value.
Right.
Because now before references could change the value of X.
However now I can't do that because now it's constant.
K and of course as a pointer this would be like this.
An X pointer to a
these are effectively equivalent terms of what they can and can't do.
So I am using these facts in the next lecture.