Code written while reading Kerninghan and Ritchie C programming book