Friday 11 November 2011

Predict the output or error(s) for the following:

#include<stdio.h>

main()

{

struct xx


{


      int x=3;


      char name[]="hello";


 };


struct xx *s;


printf("%d",s->x);


printf("%s",s->name);


}

Answer:

Compiler Error


Explanation:

You should not initialize variables in declaration

2 comments: