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;
float f1, f2;
f1 = strtof (szOrbits,&pEnd);
f2 = strtof (pEnd,NULL);
printf ("One martian year takes %.2f Earth years.\n", f1/f2);
return 0;
}
|