Pointer in C++ programming that is assigned NULL is called a null pointer. It is special type of pointer that does not point to any memory location.
#include<iostream.h>
#include<conio.h>
void main()
{
int *ptr = NULL; //assigning Null value to 'ptr'.
cout<<"The value of NULL ptr is : "<<ptr; //printing 'ptr' value.
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
char *po = "HiLaLs Afridi"; //assigning Name to Pointer 'po'.
cout<<"Your Name is: "<<po; //and printing.
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{ //assigning elements'Name' to 'arr' Pointer Array.
char *arr[4] = {"HiLaLs", "Khan", "Afridi", "PK"};
for(int i = 0; i < 4; i++) //loop looping and
{
cout<<arr[i]<<endl; //printing Names.
}
getch();
}