 
             
            Control Instructions - Programming
| Q1: What will be the output of the program?
#include<stdio.h>
int main()
{
    int a=0, b=1, c=3;
    *((a) ? &b : &a) = a ? b : c;
    printf('%d, %d, %d\n', a, b, c);
    return 0;
}
A 0, 1, 3
  B 1, 2, 3
  C 3, 1, 3
  D 1, 3, 1
  ANS:A - 0, 1, 3 Step 1: int a=0, b=1, c=3; here variable a, b, and c are declared as integer type and initialized to 0, 1, 3 respectively. Step 2: *((a) ? &b : &a) = a ? b : c; The right side of the expression(a?b:c) becomes (0?1:3). Hence it return the value '3'. The left side of the expression *((a) ? &b : &a) becomes *((0) ? &b : &a). Hence this contains the address of the variable a *(&a). Step 3: *((a) ? &b : &a) = a ? b : c; Finally this statement becomes *(&a)=3. Hence the variable a has the value '3'. Step 4: printf('%d, %d, %d\n', a, b, c); It prints '3, 1, 3'. | 
 
             
                            
                                    For help Students Orientation 
                                    Mcqs Questions
                                
                                One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.
 
                            