The code is
char** p = (char **) malloc(sizeof(char **) * size); //Where size is some valid value.
p[1] = (char*) malloc(sizeof(char) * 30);
Is the above code fine?
My understanding is
p -> +---------+
0 char* + -> {c,o,d,e,\0}
+---------+
+---------+
1 char* + -> {t,o,a,d,\0} //The assignment of these values is not shown in the code.
+---------+
So we should instead write
char** p = (char **) malloc(sizeof(char *) * size);
Am I correct?
And is p[0] means *(p + 1) where p+1 will point to "toad" so "toad" will be returned?