I'm doubtful of a way to know the length of a vector without using sizeof
:
int n = *(&arr + 1) - arr;
It is known that:
arr
is of type int ( * )
and (&arr + 1)
is of type int ( * )[size]
.
What is the function of *
?
Is it to get the value of the address (&arr + 1)
or to make a cast from int ( * )[size]
to int ( * )
?