There are built-in functions like atoi, atof, atol and so long.
By using this function you don't need to care of restictions: the given string will be converted or you get zero back!
Take a look at e.g. atoi:
function
atoi
<cstdlib>
int atoi (const char * str);
Convert string to integer
Parses the C-string str interpreting its content as an integral number, which is returned as a value of type int.
For example:
#include <stdio.h> /* printf, fgets */
#include <stdlib.h> /* atoi */
int main ()
{
int i;
char buffer[256];
printf ("Enter a number: ");
fgets (buffer, 256, stdin);
i = atoi (buffer);
printf ("The value entered is %d. Its double is %d.\n",i,i*2);
return 0;
}