c++ - what is pointer past the end of an object means? -
In C ++ primer, chapter 2, "variable and basic type", it says:
One pointer for an object and at the end of the same object is possible to capture a single address.
I am not a native speaker, and I think that is the reason why I am really confused with the "one pointer one at the end of the object" sentence. Will someone tell me what does this mean?
This means that
int a [] = {1 , 2}; Float b;
It is possible that (zero *) & amp; A [2] == (zero *) & amp; Amp; B
can be compared as true.
and [2]
(or equivalent, a + 2
) is an indicator which is at the end of a
Is because the array is only the elements of index 0 and 1.
Generally, the out-of-range array index is completely invalid (access to a [2]
is not allowed, neither is computing & amp; ; A [3]
), but before the end of an array, there is a special exception to calculate the address, because as it turned out, it is quite useful, for example when an array and you loop An ending is needed to know how to stop.
Comments
Post a Comment