The questions are as follows:
#include
int main(){char *a="Aliyun";char **b=&a;*b="programming test";char *c=++a;a="talents.";printf("%c\n",*++c);return 0;}
Ask what the output is.
We analyze it step by step.
First, the first sentence: char * a = "Aliyun";, this program declares a pointer variable a, a pointing to the constant string "Aliyun ". That is to say, the address in variable a, that is, the address that stores the string "Aliyun.
The second sentence: char ** B = & a; this statement declares a pointer. Actually, B is a pointer, but B points to a variable. That is to say, B stores the address of a. Note that it is the address of a, not the value of. Here we need to understand the concept that pointer variables are always stored in addresses, and NULL is not included.
The third sentence: * B = "programming test"; here * is called a quotient character. In simple words, it is the content pointed to by pointer B. Here * B = a; so * B is actually.
That is to say, this sentence is equal to a = "programming test"; that is, pointer a points to the new string "programming test ". Note that when a pointer is directly = string, the address of the string is assigned to the pointer. Therefore, if int * a = 12; is incorrect, it means to assign 12 to pointer a directly. Because of the different types, an error is prompted. Of course, you can also forcibly convert 12 to a pointer type value and then assign it to the variable.
Third sentence: char * c = ++ a; here the value of a is actually an address, pointing to the first character of the string "programming test", that is, "p ", ++ a is auto-incrementing first. So c actually points to "r".
The fourth sentence is interference. c and a are irrelevant.
Fifth sentence: * ++ c. That is, return an auto-increment address, and then take another character output. The original "r" is "o" after auto-increment ".
Therefore, the output is the character "o ".
Gcc is successfully verified in ubuntu.