Baloff wrote:
> Hello
> why is it that the lower index in an array occupies the highest
> number address. e.g.
>
> #include <iostream>
> using namespace std;
>
> int main() {
> int a[10];
> cout << "sizeof(int) = "<< sizeof(int) << endl;
> for(int i = 0; i < 10; i++)
> cout << "&a[" << i << "] = "
> << (long)&a[i] << endl;
ITYM
<< &a[i] << endl;
Or the not-quite-right:
<< (unsigned long)&a[i] << endl;
> }
>
> sizeof(int) = 4
> &a[0] = -1073743552 why not start 3516
> &a[1] = -1073743548
> &a[2] = -1073743544
> &a[3] = -1073743540
> &a[4] = -1073743536
> &a[5] = -1073743532
> &a[6] = -1073743528
> &a[7] = -1073743524
> &a[8] = -1073743520
> &a[9] = -1073743516 and ends with 3552
>
> where the numbers located on the physical drive relative to each other?
>
`Physical drive'? What's *that*?
HTH,
--ag
--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"