ALL
How big is sizeof structure?
First let's see the codes of a structure:struct node{ int a; int b;};Question : What's sizeof(node)? The answer is very simple, on a 32 bit machine, an int will take 4 bytes and two ints will take 8 bytes. So sizeof(node) is 8.The answer for the above codes is 8, then how about the following structure:struct node{ char a; int b;};Question : Then what's sizeof(node) now? int takes 4 bytes, char takes 1 bytes, is the answer 5?Now the answer may not be 5, on some machines, the answer is 8. Why?In fact, this is not the problem of the language. You will not find why in ANSI C. Even you ...
3,858 0 DATA STRUCTURE ALIGNMENT PACK