Pointer arithmetic refers to the application of some of the arithmetic operators to pointers. - C++ Data Type

C++ examples for Data Type:Pointer

Description

Pointer arithmetic refers to the application of some of the arithmetic operators to pointers.

Demo Code

#include <iostream>
using namespace std;
int main() {/*www .ja  v  a  2  s. co  m*/
   int i[10];
   double d[10];
   int* ip = i;
   double* dp = d;
   cout << "ip = " << (long)ip << endl;
   ip++;
   cout << "ip = " << (long)ip << endl;
   cout << "dp = " << (long)dp << endl;
   dp++;
   cout << "dp = " << (long)dp << endl;
}

Result


Related Tutorials