Home / C Programming / Complicated Declarations :: Discussion

Discussion :: Complicated Declarations

  1. What will be the output of the program?

    #include 
    
     int main() 
     {   
         struct s1  
         {       
             char *z;    
          int i;   
          struct s1 *p;    
          }; 
          static struct s1 a[] = {{"Nagpur", 1, a+1} , {"Chennai", 2, a+2} ,                              {"Bangalore", 3, a} }; 
         struct s1 *ptr = a;       
         printf("%s,", ++(ptr->z));     
         printf(" %s,", a[(++ptr)->i].z);     
         printf(" %s", a[--(ptr->p->i)].z); 
         return 0; 
     } 
    

  2. A.

    Nagpur, Chennai, Bangalore

    B.

    agpur, hennai, angalore

    C.

    agpur, Chennai, angalore

    D.

    agpur, Bangalore, Bangalore

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    No answer description available for this question.


Be The First To Comment