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                      
tip   SiteMap shows list of All Categories in this site.
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 structure padding & expalain wid example
what is bit wise structure?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is structure padding & expalain wid example what is bit wise structure?
Answer
# 1
Padding is actually a compiler optimization technique, which
fill up the area between to member to make multiples of 4
bytes (32 bits). Only combination chars/ shorts int/ both ca
e able to create a 32 bytes. Compiler actually will skip to
check the size the variable and fetch the whole 4 bytes in
data fetch operation. this will provide the aligned data to
MP in Single CPU cycle.
There is a Pragma directive, which override the compiler and
results the structure size with equal to size of variables.
 
Example:

Struct item {
              int item;
              char type;
};

Sizeof (struct item) = 8 bytes

Struct item {
              int item;
              char type[2];
              short int value;
};
Sizeof (struct item) = 8 bytes

Struct item {
              int item;
              char type[3];
              short int value;
};
Sizeof (struct item) = 12 bytes
one byte padded after "type" and 2 byes padded after value.



Bit-Wise: As far as I remember, it maintains a ARRAY of
int/char/bits equal to the number of elements defined inside
. The bit sets if some data is initialized with some value.
I am not sure on this.
 
Is This Answer Correct ?    1 Yes 0 No
Pankaj Saraf
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What is the real difference between arrays and pointers?  5
Write a programme to find even numbers without using any conditional statement? Infosys3
Write a program to exchange two variaables without temp Geometric-Software5
write a program for size of a data type without using sizeof() operator?  6
Write a program to compare two strings without using the strcmp() function Accenture6
How would you write qsort?  1
What will be result of the following program? void myalloc(char *x, int n) { x= (char *)malloc(n*sizeof(char)); memset(x,\0,n*sizeof(char)); } main() { char *g="String"; myalloc(g,20); strcpy(g,"Oldstring"); printf("The string is %s",g); } a) The string is : String b) Run time error/Core dump c) The string is : Oldstring d) Syntax error during compilation e) None of these IBM2
Find Index of least significant bit set in an Integer. ex. int value is say 10001000 results should be 4.  1
15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?  1
write a fuction for accepting and replacing lowercase letter to'Z' with out using inline function. Temenos3
What ios diff. Between %e & %f? Honeywell1
wap in c to accept a number display the total count of digit  4
what is volatile in c language? TCS1
how to find out the reverse number of a digit if it is input through the keyboard?  1
what is a far pointer TCS8
what about "char *(*(*a[])())();" Oracle2
main() { printf(5+"Vidyarthi Computers"); }  5
Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..??? TCS1
YBJBU6  1
how many times of error occur in C  7
 
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