ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
what is the defrenece between structure and union
 Question Submitted By :: Kapildalke
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is the defrenece between structure and union
Answer
# 1
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 ?    5 Yes 0 No
Renuka
 
  Re: what is the defrenece between structure and union
Answer
# 2
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 ?    5 Yes 0 No
Kapildalke
 
 
 
  Re: what is the defrenece between structure and union
Answer
# 3
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 ?    0 Yes 2 No
Nayanprakash
 
  Re: what is the defrenece between structure and union
Answer
# 4
Kapildalke -> u are rite..

the differance between a structure and union is that,

in structure memory is allocated to each and every element 
of the structure.

in union memory allocated is only of the element which 
requires maximum memory.
 
Is This Answer Correct ?    0 Yes 0 No
Shruti
 
  Re: what is the defrenece between structure and union
Answer
# 5
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 ?    0 Yes 0 No
Abhradeep Chatterjee
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
if a five digit number is input through the keyboard, write a program to calculate the sum of its digits. (hint:-use the modulus operator.'%')  9
1,1,5,17,61,217,?,?.  3
what is the differnce between AF_INET and PF_INET? Wipro2
Name the language in which the compiler of "c" in written? Bajaj1
Can I pass constant values to functions which accept structure arguments?  2
what is the difference between c and java?  1
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); } CitiGroup4
write a program to swap Two numbers without using temp variable. HP22
There is a 100-story building and you are given two eggs. The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs which didn't broke; you got to find X in a minimal number of throws. Give an algorithm to find X in minimal number of throws.  2
what is the difference between getch() and getchar()?  5
WAP to accept first name,middle name & last name of a student display its initials? NIIT2
difference of two no's with out using - operator  6
how to find the size of the data type like int,float without using the sizeof operator?  7
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3  3
WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES  1
do ne body have any idea about the salary for the we r going to have interview. yup .. u got it right ..i m talking abt NIC.  1
disadvantages of realloc ? HCL1
What's the difference between a linked list and an array?  11
how to find that no is int or float?  5
write a program to arrange the contents of a 1D array in ascending order  3
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com