ok, I see what you're saying here, but I'm a bit confused, you say that one of the differences is that a pointer can dereference information stored at an address, yet when using the line:
cout << *(a + numb) << endl;
from the above example, it dereferences at address '(a + numb)' at least I think that when you use the '*' in that way it is a dereference.
and when adding in the following code:
cout << (a + numb) << endl;
spits out an address, rather than the value of a variable or array entry
and if I add this bit of code onto the beginning of the previously mentioned sample:
1 2 3 4 5 6 7 8
|
int * b;
int c;
c = 10;
b = &c;
cout << b[0] << endl;
|
it spits out the value of 10, even though 'b' was never declared as an array.
am I missing something? Is an array just meant to act like a pointer, but in fact has something extra to differentiate it from a pointer?
I'm not trying to be argumentative here or anything, but from what I see, an array walks talks and looks like a pointer, at least it seems to get treated the same way in code. I guess my main question is, is there something that goes on under the hood of a C++ compiler that makes an array different from a pointer?