char s[] = "45"; int num = atoi(s) ... There is strtol which is better IMO. Also I have taken a liking in strtonum , so use it if you have it (but remember it's not portable):
stackoverflow.com