Complicated Declarations

Q1: What will be the output of the program?
#include<stdio.h>

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;
}

A Nagpur, Chennai, Bangalore

B agpur, hennai, angalore

C agpur, Chennai, angalore

D agpur, Bangalore, Bangalore

ANS:A - Nagpur, Chennai, Bangalore

No answer description is available. Let's discuss.



img not found
img

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.