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 null in c?

0 Answers  


what does ‘segmentation violation’ mean?

1 Answers  


Sir i need notes for structure,functions,pointers in c language can you help me please

0 Answers   TCS,


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


What is signed and unsigned?

0 Answers  






YBJBU6

1 Answers  


Can true be a variable name in c?

0 Answers  


Find occurence of a character in a sting.

3 Answers   TCS,


2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier.  Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed.  When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed.  Sequence of take-off is the sequence of addition to the waitlist

0 Answers  


enum day = { jan = 1 ,feb=4, april, may} what is the value of may? a)4 b)5 c)6 d)11 e)none of the above

8 Answers   HCL, Wipro,


which will return integer? a) int*s ( ) b) ( int* ) s( ) c) int ( *s ) ( )

1 Answers   C DAC,


What are the types of pointers in c?

0 Answers  


Categories