*array[]
means array of pointers, in your example:
char *somarray[] = {"Hello"};
somarray[]
is array of char*
. this array size is one and contains address to on string "Hello"
like:
somarray[0] -----> "Hello"
somarray
means address of first element in array.
&somarray
means array address
*somarray
means value of first element
Suppose address of "Hello"
string is for example 201, and array somaaray
at 423
address, then it looks like:
+----+----+----+---+---+----+----+----+---+----+
| `H`| 'e'|'l'|'l'|'o'| '\0'|
+----+----+----+---+---+----+----+----+---+---+----+
201 202 203 204 205 206 207 208 209 210 2
^
|
+----+----+
| 201 |
+----+----+
423
somarray
and:
somarray
gives 423
&somarray
gives 423
*somarray
gives 201
Point to be notice somarray
and &somarray
gives same value but semantically both are different. One is address of first element other is address of array. read this answer.