C++ Pointer

I tried to clear here my logic for pointer basic


Actually in c++ pointer can be declare like this

type  *var_name;


int *ip;
double *dp;
float *fp;
char *ch;


C++ NULL Pointers

It actually represent no where

int *zaki=0;
int *dhaka=NULL;

Both the examples meaning the same attitude of the c++

It actually default by the operating systems

Here is one example:

We can also define by this

if(ptr) //it will proceed if p is not null
if(!ptr) //it will proceed if p is null

Pointer arithmetic

Incrementing a pointer:

Decrementing a pointer:

Comparison with pointer:


C++ pointer vs arrays:

C++ Array of pointers

and also can store data like this with pointer and array mutually

C++ Pointer to Pointer:


Spread the love