Examveda

What will be the output of the following C code?
#include <stdio.h>
struct p
{
    int x;
    int y;
};
int main()
{
    struct p p1[] = {1, 2, 3, 4, 5, 6};
    struct p *ptr1 = p1;
    printf("%d %d\n", ptr1->x, (ptr1 + 2)->x);
}

A. 1 5

B. 1 3

C. Compile time error

D. 1 4

Answer: Option A


This Question Belongs to C Program >> Structure And Union

Join The Discussion

Related Questions on Structure and Union