struct abc
{

unsigned int a;
char b;
float r;
};
struct xyz
{
int u;
struct abc tt;
}ww;
ww = (struct xyz*)malloc(sizeof(struct xyz));
will the memory be allocated for the inner structure also?



struct abc { unsigned int a; char b; float r; }; struct xyz { int u; struct abc tt; }ww;..

Answer / sadanand

Yes. when sizeof(xyz) is done. it will compute size of
struct abc + size of int

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Interview Questions

Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

0 Answers   HCL,


How is a pointer variable declared?

0 Answers  


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

0 Answers   Lovely Professional University,


main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }

4 Answers   CitiGroup,


plz answer.... write a program that reads line (using getline) e.g."345", converts each line to an integer using "atoi" and computes the average of all the numbers read. also compute the standard deviation.

1 Answers  






Can two or more operators such as and be combined in a single line of program code?

0 Answers  


What is the difference between struct and typedef struct in c?

0 Answers  


5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.

0 Answers  


What is the scope of global variable in c?

0 Answers  


What do mean by network ?

0 Answers  


Is null valid for pointers to functions?

0 Answers  


What is union and structure?

0 Answers  


Categories