i've a small doubt in pointers, please help me out..
void main()
{
int x[10],*px=x,*py;
int i;
py = &x[5], i = py - (px);
cout << "\nThe value of px=x is:" << (int)px << "\n";
cout << "x[0]\t" << (int)x << "\n";
cout << "x[5]\t" << (int)&x[5] << "\n";
cout << "\nThe value of i=py-px is\n";
cout << i;
}
in the above program, you get the value of 'i' as the difference of the integer equivalent of the array(memory) divided by two(10/2=5).Why is it not just the difference ie, 10??
thanks in advance!!