Logo 
Search:

C Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C ProgrammingRSS Feeds

C programming practical question 40

  Shared By: Adah Miller    Date: Jan 24    Category: C Programming    Views: 70

Answer:

#include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
}


Answer:
Compiler Error


Explanation:
Initialization should not be done for structure members inside the structure declaration


Share: 
 

Didn't find what you were looking for? Find more on C programming practical question 40 Or get search suggestion and latest updates.


Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: