data structures using pointer expressions and pointer arithmetic like other variablespointer variables can also be used in expressions for exampleif ptr and ptr are pointersthen the following statements are validint num num sum mul div int *ptr *ptr ptr &num ptr &num sum *ptr *ptr mul sum (*ptr )*ptr + div (*ptr )/(*ptr in cthe programmer may add integers to or subtract integers from pointers as well as subtract one pointer from the other we can also use shorthand operators with the pointer variables as we use them with other variables also allows comparing pointers by using relational operators in the expressions for examplep = and are all valid in postfix unary increment (++and decrement (--operators have greater precedence than the dereference operator (*thereforethe expression *ptr+is equivalent to *(ptr++)as +has greater operator precedence than thusthe expression will increase the value of ptr so that it now points to the next memory location this means that the statement *ptr+does not do the intended task thereforeto increment the value of the variable whose address is stored in ptryou should write (*ptr)+null pointers so farwe have studied that pointer variable is pointer to variable of some data type howeverin some caseswe may prefer to have null pointer which is special pointer value and does not point to any value this means that null pointer does not point to any valid memory address to declare null pointeryou may use the predefined constant null which is defined in several standard header files including and after including any of these files in your programyou can write int *ptr nullyou can always check whether given pointer variable stores the address of some variable or contains null by writingif (ptr =nullstatement blockyou may also initialize pointer as null pointer by using the constant int *ptrptr this is valid statement in as null is preprocessor macrowhich typically has the value or replacement text howeverto avoid ambiguityit is always better to use null to declare null pointer function that returns pointer values can return null pointer when it is unable to perform its task generic pointers generic pointer is pointer variable that has void as its data type the void pointeror the generic pointeris special type of pointer that can point to variables of any data type it is declared like normal pointer variable but using the void keyword as the pointer' data type for examplewww allitebooks com