What is size of union in c?



What is size of union in c?..

Answer / Akshit Shakolay

"The size of a union in C is equal to the size of the largest data type it contains. This is because all data within a union occupies the same memory location, and the compiler only allocates enough space for the largest element."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What do you mean by scope of a variable in c?

1 Answers  


What is unary operator?

1 Answers  


what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }

3 Answers   Honeywell,


int main() { int i=-1,j=-1;k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d%d%d%d%d",i,j,k,l,m); }

3 Answers   HCL,


int array[]={1,2,3,4,5,6,7,8}; #define SIZE (sizeof(array)/sizeof(int)) main() { if(-1<=SIZE) printf("1"); else printf("2"); }

2 Answers   Vector,


How are pointers declared in c?

1 Answers  


What are data breakpoints?

3 Answers   Adobe,


count the numbers between 100 and 300, that star with 2 and ends with 2

5 Answers   Mind Tree,


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1 Answers   Aspire, Infogain,


any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above

1 Answers  


How are variables declared in c?

1 Answers  


What is a static function in c?

1 Answers  


Categories