char ** x is a pointer to a pointer, which is useful if you want to modify an existing pointer outside its scope (for example, inside a function call).
This is important because C goes through the copy, so to change the pointer inside another function, you need to pass the address of the pointer and use the pointer to the pointer like this:
void modify(char **s) { free(*s);
You can also use char ** to store an array of strings. However, if you dynamically highlight everything, be sure to keep track of how long the array of strings is, so that you can scroll through each element and free it.
Regarding your last question, char * str; just declares a pointer without allocated memory, whereas char str [10]; allocates an array of 10 characters in the local stack. The local array will disappear as soon as it goes out of scope, so if you want to return a string from a function, you want to use a pointer with dynamically allocated memory (malloc'd).
In addition, char * str = "Some string constant"; is also a pointer to a string constant. String constants are stored in the global data section of your compiled program and cannot be changed. You do not need to allocate memory for them, because they are compiled / hardcoded into your program, so they already occupy memory.
source share