1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
/* strtof example */
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char szOrbits[] = "686.97 365.24";
char * pEnd;
double d1, d2;
d1 = strtof (szOrbits,&pEnd);
d2 = strtof (pEnd,NULL);
printf ("One martian year takes %.2f Earth years.\n", d1/d2);
return 0;
}
|