what is the defrenece between structure and union
Answers were Sorted based on User's Feedback
Answer / kapildalke
Thanks for these answer renuka..............
it means that
struct student
{
int i;
char a,b;
}
it occupy 4 bytes of memory..........
and in case of union
union student
{
int i;
char a,b;
}
it occupies only 2 byte memory.............
Am i write or wrong
Is This Answer Correct ? | 21 Yes | 0 No |
Answer / renuka
structure is declared with the keyword struct and structure
variables occupy individual memory location.But Unoin is
declared with the keyword union and its variables are
allocated to a memory at which the highest byte of the
variable is declared.
Is This Answer Correct ? | 16 Yes | 0 No |
Answer / abhradeep chatterjee
all of you are correct. ya, structure is declared with the
keyword struct and structure
variables occupy individual memory location.But Unoin is
declared with the keyword union and its variables are
allocated to a memory at which the highest byte of the
variable which is declared.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / nayanprakash
union is better then structure.union is declared with
keyword union.it can store more data which can store at
hights byte of veeriable is declared.structure is declred
a keyword struct.it will store for indivisul memory space.
Is This Answer Correct ? | 1 Yes | 5 No |
To find whether a number is even or odd without using any conditional operator??
12 Answers College School Exams Tests, IBM,
identify the in correct expression a.a=b=3=4; b.a=b=c=d=0; float a=int b=3.5; d.int a; float b; a=b=3.5;
What is the description for syntax errors?
I need a sort of an approximate strcmp routine?
Explain 'bus error'?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
find the minimum of three values inputted by the user
What are the two types of structure?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
5 Answers TCS, Vimukti Technologies,
List the different types of c tokens?
What is a pragma?
How many data structures are there in c?