2 ms·
*(const char * + char *) The type of int i is converted to 'char *' and multiplied by sizeof(char) I am pretty certain this explanation does not make any sens
by saurik 11y ago
*(const char * + char *) The type of int i is converted to 'char *' and multiplied by sizeof(char)
I am pretty certain this explanation does not make any sense: what is really happening here is that the int, for purposes of the addition, is measuring units sizeof the object being pointed to; there is no meaning I know of to adding two pointers.
/* This works because "Hello"[5] == 5["Hello"].*/
At this point, you could really just say the following:
/* This works because a[b] == *(a + b), and addition is commutative. */