look for atoi() function...
it will return zero if it is not able to convert the string passed into number..

though if you have an alphanumeric inputs (like 1234go4expert)..u should go for strtol()..

both the functions even convert the input passed into their respective numbers(if possible).