|    | 
     
 | 
    
                     
        
 
 
  
    Choose the correct option of C Language  Question Posted on 01 Feb 2021   Home >> Programming Languages >> C >> Choose the correct option of C Language |   
     
    
     
 
    
 Choose the correct option of C Language
 Below are the different questions of C language and choose the correct answers
 (1)Find output of below code
 #include 
 int main()
 {
   static int a=5;
   if(--a)
   {
    main();
    printf("%d ",a);
   }
   return 0;
 }
 Choose the correct options from below list
 (i)1 2 3 4
 (ii)4 3 2 1
 (iii)0 0 0 0
 (iv)Compiler Error
 
 
 (2)Find output of below code
 #include 
 int main()
 {
   static int i=5;
   if (--i)
   {
    printf("%d ",i);
    main();
   }
 }
 Choose the correct options from below list
 (i)1 2 3 4
 (ii)4 3 2 1
 (iii)0 0 0 0
 (iv)Compiler Error
 
 
 (3)Find output of below code
 #include 
 int main()
 {
   int x = 5;
   int * const ptr = &x;
   ++(*ptr);
   printf("%d", x);
   return 0;
 }
 Choose the correct options from below list
 (i)Compiler Error
 (ii)Runtime Error
 (iii)6
 (iv)5
 
 
 (4)Find output of below code
 #include 
 int main()
 {
   int x = 5;
   int const * ptr = &x;
   ++(*ptr);
   printf("%d", x);
   return 0;
 }
 Choose the correct options from below list
 (i)Compiler Error
 (ii)Runtime Error
 (iii)6
 (iv)5
 
 
 (5)Find output of below code
 #include
 int main()
 {
   typedef static int *i;
   int j;
   i a = &j;
   printf("%d", *a);
   return 0;
 }
 Choose the correct options from below list
 (i)0
 (ii)Runtime Error
 (iii)Garbage Value
 (iv)Compiler Error
 
 Answer:-
 (1)(iii)0 0 0 0
 (2)(ii)4 3 2 1
 (3)(iii)6
 (4)(i)Compiler Error Reason:-++(*ptr) is incorrect
 (5)(iv)Compiler Error Reason:- typedef static int *i; |  |    
 
 
 
    
 
 
 
 
 
 
  
    
    
    
    
     | 
  | 
        
         | 
      
     
    
    
    
     |