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 |
What is return type in c?
Write a C program in Fibonacci series.
Is main is user defined function?
Reverse the part of the number which is present from position i to j. Print the new number. eg: num=789876 i=2 j=5 778986
Why void main is used in c?
write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR
how the size of an integer is decided? - is it based on processor or compiler or OS?
19 Answers HCL, JPR, Microsoft, nvidia,
What does typedef struct mean?
What is an auto variable in c?
What is a pointer?
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
Discuss similarities and differences of Multiprogramming OS and multiprocessing OS?