What is the main difference between STRUCTURE and UNION?

Answers were Sorted based on User's Feedback



What is the main difference between STRUCTURE and UNION?..

Answer / shilpa

in union the size allocated is the size of the highest
member whereas in structure the size allocated is the sum of
the size of all its declerations. 

Is This Answer Correct ?    1 Yes 0 No

What is the main difference between STRUCTURE and UNION?..

Answer / rakesh kumar

Hi frnds...
structure and union made for different purpose....
There are no comprision between them....
frnds how can campare a car and a coconut tree....

Is This Answer Correct ?    4 Yes 15 No

What is the main difference between STRUCTURE and UNION?..

Answer / anurag

At the one time only one data member can be access...or can
be used.

Is This Answer Correct ?    78 Yes 101 No

Post New Answer

More C Code Interview Questions

Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

9 Answers   CSC, GoDB Tech, IBM,


How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  






How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  


how to swap 3 nos without using temporary variable

4 Answers   Satyam,


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

0 Answers  


How to read a directory in a C program?

4 Answers  


What is your nationality?

1 Answers   GoDB Tech,


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

2 Answers  


Categories