You have not included stdlib.h. Add correct includes:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str[10]="3.5";
printf("%lf",atof(str));
return 0;
}
Without including stdlib.h, it is atof()
declared implicitly and the compiler assumes that it returns int.
source
to share