24, ఏప్రిల్ 2023, సోమవారం

 structure padding and packing:

Structure is of user defined data types, Could be with the different combination of data types. When structure is defined with different data types, this data types aligned with padding to its natural boudaries of data, to reduce the CPU cycles.

struct sample {

char a;

char b;

int c;

}

If structure padding is not there to read an int variable it takes 2 CPU cycles, where as with structure padding it takes a single cycle.


0 కామెంట్‌లు:

కామెంట్‌ను పోస్ట్ చేయండి

దీనికి సబ్‌స్క్రయిబ్ చేయి కామెంట్‌లను పోస్ట్ చేయి [Atom]

<< హోమ్