Is this just an exercise, or are you deliberately avoiding <limits.h> and <stdint.h>?