R
Rolf Magnus
arnuld said:On Apr 2, 11:55 pm, "Daniel T." <[email protected]> wrote:Given 'arr' is declared as "const char* arr[]" then:
arr and &arr[0] are effectively the same thing.
&arr is the address of arr.
So. arr[0] is a const char*, arr and &arr[0] is the address of the const
char*, and &arr is the address of the address of a const char*.
Now check this out:
arr[0][0] is a const char...
![]()
i got it, say:
const char* arr[] = { "Daniel", "Tartaglia" }
it is an array of ararys,
No, it's not. It's an array of pointers.
because elements, e.g. /Daniel/ itself is a character array.
Yes, that's right. Still, arr is an array of _pointers_. The first element
(arr[0]) points to the first character of the character array "Daniel", the
second element of arr points to the first character of "Tartaglia".
so
1.) /arr/ and /&arr[0]/ give the address of 1st element of arr[]
Yes.
2.) &arr, will give the address of "D" of /Daniel/ (array inside an
array)
No, it won't. &arr gives the address of the array. *arr would give you the
address of the 'D'.