Pointer Operations
#include <stdafx.h>
#include <iostream>
#include <string>
using namespace std;
/* There are four arithmetic operators that can be used on pointers: ++, --, +, and - */
int main()
{
int i=100;
int *ptr=&i;
cout << "Address hold by ptr: "<< ptr << endl;
ptr++; /* Points to next integer location(4 bytes after the current location). If it is a character pointer it will point to next character location(1 byte after the
current location).*/
cout << "Address hold by ptr: "<< ptr << endl;
return 0;
}
Output:
Address hold by ptr: 002EF9E0
Address hold by ptr: 002EF9E4