I did my C programming exam yesterday. There was a question that I could not answer, and although I studied today, I can not come up with a solution.
So we have this:
int A= -1 , B= -2, C= -3, X=1;
X = B != C ? A=(~C) - A-- : ++C + (~A);
printf("A= %d B= %d C =%d X=%d \n", A,B,C,X);
I know this operator function, if X = B != Ctrue, then it is executed A=(~C) - A--. If it is erroneous, it is executed ++C + (~A).
Can someone tell me and explain what are the meanings of A, B, C and X in this printf?
NEW
This was included in a question that asks for a “trace” for the entire program:
void main(){
int A= -1 , B= -2, C= -3, X=1;
X = B != C ? A=(~C) - A-- : ++C + (~A);
printf("A= %d B= %d C =%d X=%d \n", A,B,C,X);
if(~A){
printf("\n out1\n");
C= A | B
printf("A= %d B= %d C =%d X=%d \n", A,B,C,X);
C= C <<1;}
if(A^B){
printf("\n out2\n");
C= B & A
B += 2
X= X>>1
printf("A= %d B= %d C =%d X=%d \n", A,B,C,X);
By the way, can anyone tell me what that means, those ifconditions?