#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

main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256

2 Answers   HCL,


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }

1 Answers  


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,






Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,


how to return a multiple value from a function?

5 Answers   Wipro,


# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }

1 Answers  


main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; }

2 Answers  


what is variable length argument list?

2 Answers  


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

0 Answers   Honeywell,


how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


Categories