I am using IDE Code :: Blocks with the GNU GCC compiler.
struct test { char a; char e; char f; char b; char d; };
sizeof(test) returns 5 .
I read this answer: Why is the sizeof size for the structure not equal to the sum of the sizeof of each member?
How is it that there is no indentation after the last char , so sizeof(test) returns 6 or 8 ? There are some more questions that I could ask by adding short and int , etc. But I think this question is good now. Would it be a complement to simplify the processor's work with the structure?
c ++ c padding
newprogrammer
source share