它声明了一个指向指针的char指针。
这种指针的用法是做这样的事情:
void setCharPointerToX(char ** character) {
*character = "x"; //using the dereference operator (*) to get the value that character points to (in this case a char pointer
}
char *y;
setCharPointerToX(&y); //using the address-of (&) operator here
printf("%s", y); //x
这是另一个例子:
char *original = "awesomeness";
char **pointer_to_original = &original;
(*pointer_to_original) = "is awesome";
printf("%s", original); //is awesome
使用**数组:
char** array = malloc(sizeof(*array) * 2); //2 elements
(*array) = "Hey"; //equivalent to array[0]
*(array + 1) = "There"; //array[1]
printf("%s", array[1]); //outputs There
数组上的[]运算符本质上是对前指针进行指针运算,因此,array[1]评估方式如下:
array[1] == *(array + 1);
这是数组索引从 开始的原因之一0,因为:
array[0] == *(array + 0) == *(array);