stdlib

function atoi

The C library function int atoi(const char *str) converts the string argument str to an integer

Parameters

str − This is the string representation of an integral number.

Return Value

This function returns the converted integral number as an int value. If no valid conversion could be performed, it returns zero.

Example
char str[] = "123";
int a = atoi(str);
printf("%d\n", a);
			
stdlib

function atof

The C library function double atof(const char *str) converts the string argument str to a floating-point number (type double).

Parameters

str − This is the string having the representation of a floating-point number.

Return Value

This function returns the converted floating point number as a double value. If no valid conversion could be performed, it returns zero (0.0).

Example
char str[] = "3.78";
double a = atof(str);
printf("%lf", a);