2
I am doubtful in a way to know the length of a vector without using sizeof
:
int n = *(&arr + 1) - arr;
It is known that:
arr
is the type int ( * )
and (&arr + 1)
is the type int ( * )[size]
.
What is the function of *
?
It’s to get the address amount (&arr + 1)
or to cast a int ( * )[size]
for int ( * )
?
Behold: Doubt about C pointers.
– Pedro Gaspar