What is the difference between struct and union in C?



What is the difference between struct and union in C?..

Answer / hrpynux@gmail.com

A struct is a block of memory that stores several data objects, where those objects don't overlap. A union is a block of memory that stores several data objects, but has only storage for the largest of these, and thus can only store one of the data objects at any one time.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is extern keyword in c?

0 Answers  


What is the most efficient way to count the number of bits which are set in an integer?

0 Answers  


How to write a program for swapping two strings without using 3rd variable and without using string functions.

7 Answers   iGate, Infotech,


how to swap 2 numbers within a single statement?

4 Answers  


write a programe returns the number of times the character appears in the string

2 Answers  






What are file streams?

0 Answers  


Difference between MAC vs. IP Addressing

0 Answers  


In scanf h is used for

4 Answers   BFL,


What is structure in c definition?

0 Answers  


#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x?

16 Answers   Accel Frontline, Opera, Oracle,


What are qualifiers in c?

0 Answers  


Explain what is operator promotion?

0 Answers  


Categories