I like to use a Pointer to char array. And then I would like to do a Pointer Arithmetic by incrementing the Pointer. Finally I would like to see the Addresses of the Pointer to each of the char Array Elements. I had created a program below, but I am not getting any Addresses from my Pointer. Is there anything I am doing wrong here.
#include <iostream>
using namespace std;
int main ()
{
int ArraySize;
char ch[]= "This is a Char Pointer";
char* iPtr = ch;
cout << endl << endl << "Using POINTER ARITHMETIC now " << endl;
for (int i = 0; i < ArraySize; i++, iPtr++){
cout << "The address of index " << i
<< " of the POINTER is "<< iPtr << endl;
cout << "The value at index " << i
<< " of the POINTER is "<< *iPtr << endl;
}
return 0;
}