NULL Pointer#include<iostream>using namespacestd;intMain () {//Assigning a NULL value to a pointer variable is a good programming practice if there is no exact address to assign a value to. A pointer that is assigned a null value is called a null pointer. int*ptr =NULL; cout<<"ptr is"<< ptr <<Endl; if(PTR) {cout<<"Do not print"<<Endl; } Else{cout<<"Run"<<Endl; } return 0;}/*vim:set ts=4 sw=4 sts=4 tw=100*/
arithmetic operations for pointers "+ +-+-"#include<iostream>using namespacestd;Const intMAX =3;intMain () {int var[MAX] = {Ten, -, $}; int*ptr; PTR=var; for(intI=0; i < MAX; i++) {cout<<"Address of Var ["<< I <<"] ="; cout<< ptr <<Endl; cout<<"Value of var["<< I <<"] ="; cout<< *ptr <<Endl; PTR++; } return 0;}/*vim:set ts=4 sw=4 sts=4 tw=100*/
Comparison of Pointers#include<iostream>using namespacestd;Const intMAX =3;intMain () {int var[MAX] = {Ten, -, $}; int*ptr; *(var+2) = -; PTR=var; while(PTR <= &var[MAX-1]) {cout<< ptr <<"&"<< *ptr <<Endl; PTR++; } return 0;}/*vim:set ts=4 sw=4 sts=4 tw=100*/
A detailed description of the pointer