what is the difference between structure and union?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the function of this pointer?

675


in linking some of os executables are linking name some of them

1652


Define macros.

786


write a program to display all prime numbers

1457


What is a void pointer? When is a void pointer used?

627






What are pointers? What are different types of pointers?

633


What is identifiers in c with examples?

678


Explain indirection?

649


What are run-time errors?

601


How a string is stored in c?

590


Which one would you prefer - a macro or a function?

605


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1469


What is c language and why we use it?

625


What is c system32 taskhostw exe?

595


Can include files be nested? How many levels deep can include files be nested?

660