#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);

}



#include<stdio.h> main() { struct xx { ..

Answer / susie

Answer :

Compiler Error

Explanation:

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

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Code Interview Questions

Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list)

3 Answers   Disney, Google, ZS Associates,


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

0 Answers   Honeywell,


struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); }

1 Answers  


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  






Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  


What is the main difference between STRUCTURE and UNION?

13 Answers   HCL,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped

1 Answers   IBM,


#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?

1 Answers   Wipro,


Categories