what is the difference between structure and union?

Answers were Sorted based on User's Feedback



what is the difference between structure and union?..

Answer / karthikeyan

union is unified memory where structure is non unified memory.

all members of structure occupy consecutive chunks of
memory.but union members will share the most highest memory
of the union member.i.e data type.

we can access all the members of structure at a time.

but in union we can access a single union member at a time.

regards,

karthikeyan,
TRIOZTECH

Is This Answer Correct ?    9 Yes 0 No

what is the difference between structure and union?..

Answer / dasari chaithanya

The difference between structure and union is ,structure
will occupie total number of bytes or memory sometimes
waste memory,but union is which is the higest memory than
the data will store the memory location.

Is This Answer Correct ?    3 Yes 0 No

what is the difference between structure and union?..

Answer / sevak.yatrik777

While structure enables us treat a number of different
variables stored at different in memory , a union enables us
to treat the same space in memory as a number of different
variables. That is a Union offers a way for a section of
memory to be treated as a variable of one type on one
occasion and as a different variable of a different type on
another occasion.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is a struct c#?

0 Answers  


What are external variables in c?

0 Answers  


What is restrict keyword in c?

0 Answers  


What is the difference between text and binary modes?

0 Answers  


What is an auto variable in c?

0 Answers  






a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list

0 Answers  


Explain bitwise shift operators?

0 Answers  


Write a program to compute the following 1!+2!+...n!

4 Answers  


What character terminates all strings composed of character arrays? 1) 0 2) . 3) END

3 Answers  


whenever a question is posted in a particular category in allinterview.com, Is there any facility to receive an indication mail. For eg: I need to receive an indication email, whenever a question is posted under the category “C Langauage”.

1 Answers  


All technical questions

0 Answers   TCS,


Explain what standard functions are available to manipulate strings?

0 Answers  


Categories