Examveda
Examveda

Determine Output:
void main()
{
      struct xx
      {
            int x=3;
            char name[] = "hello";
      };
      struct xx *s = malloc(sizeof(struct xx));
      printf("%d", s->x);
      printf("%s", s->name); 
}

A. 3 hello

B. Compiler Error

C. Linking error

D. None of these

Answer: Option B

Solution(By Examveda Team)

Initialization should not be done for structure members inside the structure declaration.


This Question Belongs to C Program >> C Miscellaneous

Join The Discussion

Comments ( 1 )

  1. RAVINA RAUNDALE
    RAVINA RAUNDALE :
    6 years ago

    I did not get

Related Questions on C Miscellaneous