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 are the differences between new and malloc in C?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
Why Modern OS are interrupt driven?Give an example
how to find your architecture is LittleEndian or BigEndian?
there is two conditions , 1. while using for loop for printing 1 to 50 no's simulteneous 2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables who will take more time for compiling and execution? explain in details with reason?
What are the concepts introduced in OOPs?
main() { int l=6; switch(l) { default:l=l+2; case 4:l=4; case 5:l++; break; } printf("%d",l); }
Explain what is a static function?
how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--);
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
f=(x>y)?x:y a) f points to max of x and y b) f points to min of x and y c)error
Can anyone help me with this please? Need to print the below values.. Thanks 1 1 2 1 2 3 1 2 3 4