Use the function atof
defined in stdlib.h
and sprintf
:
float a = 3;
int b = 5;
char tmp[10];
sprintf(tmp, "%fe%d", a, b);
double x = atof(tmp);
printf("x = %fe%d = %f\n", a, b, x);
Output: http://ideone.com/NdDcNB
x = 3.000000e5 = 300000.000000