C Tutorial C 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





Like structs, but only stores the most-recently-written field.


union {


int ival; float fval; char *sval;

} u;


  • Useful for arrays of dissimilar objects 

  • Potentially very dangerous: not type-saf

  • Good example of Cs philosophy: Provide powerful mechanisms that can be abused

Contact for more learning: webmaster@freehost7com