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

Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

0 Answers   IBM,


What is Memory leakage ?

2 Answers   HCL,


how i m write c program 1.check prime number 2.prime number series

1 Answers  


What is non linear data structure in c?

0 Answers  


What is the difference between functions getch() and getche()?

0 Answers  






How do you determine the length of a string value that was stored in a variable?

0 Answers  


Lists the benefits of c programming language?

0 Answers  


What are the 3 types of structures?

0 Answers  


What do you mean by invalid pointer arithmetic?

0 Answers  


We can draw a box in cprogram by using only one printf();& without using graphic.h header file?

4 Answers   NIIT,


What are c identifiers?

0 Answers  


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


Categories