C Tutorial Layout of records and unions
The C Language
C History
Euclid’s Algorithm in C
Euclid on the PDP-11
Pieces of C
C Types
Struct bit-fields
Code generated by bit fields
C Unions
Layout of Records and Unions

C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation and Handles
Automatic Garbage Collection
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions
Nondeterminism in C





Modern processors have byte-addressable memory.

Many data types (integers, addresses, floating-point numbers) are wider than a byte.

 Modern memory systems read data in 32-, 64-, or 128-bit chunks:

Reading an aligned 32-bit value is fast: a single


 Slower to read an unaligned value: two reads

 plus shift.

SPARC prohibits unaligned accesses.



  • MIPS has special unaligned load/store instructions. x86, 68k run more slowly with unaligned accesses.

  • Most languages “pad” the layout of records to ensure alignment restrictions.



struct padded {


int x;   /* 4 bytes */ char z;  /* 1 byte */ short y; /* 2 bytes */ char w;  /* 1 byte */




Contact for more learning: webmaster@freehost7com