Using null pointers.
So a pointer could point to anywhere in the memory installed on your computer.
So and an assignment that the reference pointer means that you could potentially write over sensitive
memory used by operating systems so or write to memory used by hardware on your machine.
However, the operating systems will usually give an executable, a specific memory range that it can
access and it tends to access memory.
And if it attempts to access memory out of this range, this it will cause an operating system memory
access violation.
So for this reason you should almost always opt in pointer values using the and operator here or from
a call to an operating system function.
So you should not give a pointer an absolute address.
The only exception to this is the C plus plus constant for invalid memory address nullptr here.
So for example, let's define the pointer here.
Let's define the pointer here and assign it as new.
Here you add the code and integer A and 62.
And then assign P here our a variable a a integer variable here and code here as well.
For example, just an example code.
We won't write it in this lecture here.
So if our nullptr not equals to P, then.
C out STD.
Here.
See out here and.
P with asterisk here and and here.
So this code initializes the pointer pointer p to nullptr.
Here we get an error here and line.
Yes.
So this code initialized p to nullptr.
Later in the code the pointer is initialized to the address of an integer variable.
So still later in the code the pointer is used, but rather than calling it immediately.
So the pointer is first check to ensure that it has been initialized to a non null value.
So the compiler will check to see if you are about to use a variable that has not been initialized.
But if you are writing library code, the compiler will not know whether the colors of your code will
use pointers correctly.
So the type here type of constant nullptr is not an integer.
It is here a STD.
No variables so I'll pointers type can be implicitly converted to this type, so nullptr can be used
to initialize variables of all pointer types.