:: Home Page            
 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                      
Categories >> Software >> Programming Languages >> C


 C interview questions  C Interview Questions (2265)
 C++ interview questions  C++ Interview Questions (1119)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
What is the difference b/w Structure & Union?
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
# 1
Memory allocated for any structure is equal to the sum of
memory required by each structure member.

Example: In a structure 'abc' below, memory allocated will
be 7 Bytes (2 Bytes for int a + 1 Byte for char b + 4 Bytes
for float c ina 32 bit processor)
struct abc
int a;
char b;
float c;

But in union memory allocated for it is equal to the memory
required by the biggest (in terms of memory it use) union

Example: In a union 'abc' below, memory allocated will be 4
Bytes as float c is the biggest union member here and it
uses 4 Bytes of memory in 32 bit processor.

union abc
int a;
char b;
float c;
Is This Answer Correct ?    19 Yes 1 No
Nakul Sharma
# 2
in structure struct key word is used but in union union key
word is used.
Is This Answer Correct ?    6 Yes 9 No
# 3
struct can hold multiple data types.
Like u can define a date structure....
but union can multiple data types which includes struct also

union x
int x;
Is This Answer Correct ?    2 Yes 7 No
Raj Kumar

Other C Interview Questions
  Question Asked @ Answers
What is the difference between i++ and i+1 ?(in terms of memory) HCL 3
how can u print a message without using any library function in c NIIT 1
print 1-50 with two loop & two print Statement   2
How to find the usage of memory in a c program Infosys 1
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ? NetApp 1
int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p? Verifone 6
if we take a number as a char then can we manipulate(add, subtract) on this number   2
what is the purpose of the code, and is there any problem with it. bool f( uint n ) { return (n & (n-1)) == 0; } google 1
Diff: between this 2 classes in terms of memory class A { int i; char c; double d; }; class A { double d; int i; char c; }; How it is calculating? HCL 1
what is a function prototype?   1
Can we write a program without main() function?   9
For more C Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::