Why is structure padding done in c?



Why is structure padding done in c?..

Answer / Jafar Ali

Structure padding is employed in C to ensure proper alignment of structure members on certain hardware architectures. This can improve performance, as some processors require data structures to be aligned on specific boundaries for optimal access speeds.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

multiple of 9 without useing +,* oprator

3 Answers  


what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;

2 Answers   Google,


Explain what is the difference between a free-standing and a hosted environment?

1 Answers  


# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none

7 Answers   Microsoft, TCS,


Why do u use # before include in a C Progam?

9 Answers   IBM,


what is pointer

1 Answers   TCS,


in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?

4 Answers   Infosys, NetApp,


What is an endless loop?

1 Answers  


What is integer constants?

1 Answers  


how to build a exercise findig min number of e heap with list imlemented?

1 Answers  


C language questions for civil engineering

1 Answers   Tech Mahindra,


what is difference between array of characters and string

18 Answers   Accenture, Nest,


Categories