:: 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
Write a C program that reads a series of strings and prints only those ending in "ed" Accenture 2
Which of the following are valid "include" formats? A)#include and #include[file.h] B)#include (file.h) and #include C)#include [file.h] and #include "file.h" D)#include <file.h> and #include "file.h" Accenture 15
What is volatile   2
What is the difference between %d and %*d in C   3
Write the following function in C. stripos Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return - 1. The function should not make use of any C library function calls. Google 3
How would you print out the data in a binary tree, level by level, starting at the top? Microsoft 6
What is the output of following program ? int main() { int x = 5; printf("%d %d %d\n", x, x << 2, x >> 2); } Qualcomm 4
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen) NetApp 1
void main() {int i=2; printf("%d%d%d",i,++i,i++); getch(); }   8
Difference between data structure and data base. Value-Labs 5
Define function pointers?   1
how to write hello word without using semicolon at the end? Accenture 5
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.   ::