Учу С. Застрял на таком примере:
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#undef atof
/*atof: преобразование строки s в double */
double atof (char s[])
{
double val, power, exp;
int i, sign, esign;
for (i = 0; isspace(s[i]); i++)
; /* игнорирование левых символов-разделителей */
sign = (s[i] == '-') ? -1 : 1;
if (s[i] == '+' || s[i] == '-')
i++;
for (val = 0.0; isdigit(s[i]); i++)
val = 10.0 * val + (s[i] - '0');
if (s[i] == '.')
i++;
for (power = 1.0; isdigit(s[i]); i++)
{
val = 10.0 * val + (s[i] - '0');
power *= 10.0;
}
if (s[i] == 'e' || s[i] == 'E')
i++;
esign = (s[i] == '-') ? -1 : 1;
if (s[i] == '+' || s[i] == '-')
i++;
for (exp = 0.0; isdigit(s[i]); i++)
exp = 10.0 * exp + (s[i] - '0');
return pow(sign * val / power, esign * exp);
}
int main(int argc, char **argv)
{
printf("%f", atof("123.45e-6"));
return 0;
}
gcc -Wall -o "u4_2" "u4_2.c"
/tmp/ccZuJ2qw.o: In function `atof':
u4_2.c:(.text+0x209): undefined reference to `pow'
collect2: ld returned 1 exit status