C input validation