Okay.
Today i get a new concept about pointer:
I usually treat pointer as a tag of address. But now I think i made some mistakes.
First of all: when a pointer point to the the first of address (eg. array ), it obviously shows that the property of "index" or "offset". Its behavior represents you tell the hardware where the base address is, then when you try to operate it. the typical operation just likes the “add" and "minus" , it means the hardware should justice the next action, drift action show immediately.
Right now i know GNU C++ compiler which have this behaviors:
for instance:
// tacos[8]:: index(8) - tacos[1]::index(1) = 8 - 1 = 7, the result is 7....
# include <iostream>
int main()
{
using namespace std;
int tacos[10] = {5,2,8,4,1,2,2,4,6,8};
int * pt = tacos;
cout << "Pt's address: " << pt << endl;
pt = pt + 1;
cout << "Pt's address: ” << pt << " and " << * pt << endl;
int * pe = & tacos[9];
pe = pe -1; // tacos[8]::index - tacos[1]::index = 1
int diff = pe - pt;
cout << "pt's value: " << *pt << endl;
cout << "pe's value: " << *pe << endl;
cout << "diff's value: " << diff << endl;
return 0;
}