borrowing K&R implementation of itoa()