Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - int a=3,b=4,* q = & ampb; * q = a+b; a = 5; q =(a & lt; b)? & A: & How to calculate printf("%d %d %d\n ",a, b, *q),
int a=3,b=4,* q = & ampb; * q = a+b; a = 5; q =(a & lt; b)? & A: & How to calculate printf("%d %d %d\n ",a, b, *q),
int a=3,b=4,* q = & ampb; //Define two integer variables A and B and assign values. Define the integer pointer variable q and assign the address of the variable b to Q. Is to get the address

* q = a+b; //*q represents the address pointed by the pointer variable q, and the value of a+b is assigned to this address. It's an address denoted by B. b=a+b=3+4=7

a = 5; //assign a value to a, a=5.

q =(a & lt; b)? & A: & //expression 1? Expression 2: Expression 3. If the expression 1 is true or non-zero, the value of expression 2 is taken as an integer value; If false, it is zero. Take expression 3 as an integer value.

//& amp; A and&; B is the address of a and b, and q = (a <; b)? & A:& = (5 <; 7)? & A: & ampb= (true)? & A:& =&A. Q points to A.

printf("%d %d %d\n ",a,b,* q); //a=5,b=7,*q=a=5