so start is a reference = memory address?
>
content of start is likely to be something like -
0x12349870h
>
??
>
>>int const& start
>>
>start is a reference to a constant int (the int doesn't change).
A reference doesn't actually exist. A reference is an alias. The compiler
is free to do that however it wishes. The compiler may actually use the
original variable, or the address, or some other method. You shouldn't
count on how the compiler does it as it may change from compiler to compiler
and even from compiler version to version.
I suppose the following is exact same thing right?
>
int * const start
int const * start
>
both means the pointer is constant - (pointer always point to same
address)
No. Those are not the same.
const int* start;
int const* start;
are exactly the same.
int* const start;
start is a constant *pointer* to an int. You can not reseat the poniter.
You can not change where the pointer is pointing to. In fact you better
initialize it since you can't change it. But you can change the integer
that the pointer points to.
int const * start;
start is a pointer to a constant *integer* You can not change the value of
what the pointer points to, but you are free to make the pointer point to
some other memory location.
Comment