Lecture 4 : Data Structures, Debugging
note: Structure Memory
ex.
#include <stdio.h> int main() { struct X { short s; int i; char c; }; struct Y { int i; char c; short s; }; struct Z { int i; short s; char c; }; printf("%ld\n", sizeof(struct X)); printf("%ld\n", sizeof(struct Y)); printf("%ld\n", sizeof(struct Z)); return 0; }
12 8 8
Ref. http://ocw.mit.edu/courses/mathematics/18-01sc-single-variable-calculus-fall-2010/