fork download
  1. #include <math.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main(void) {
  6. char *s = "123ez";
  7. char *endptr;
  8. double d = strtod(s, &endptr);
  9. printf(" double %lf '%s'\n", d, endptr);
  10. long double ld = strtold(s, &endptr);
  11. printf("long double %Lf '%s'\n", ld, endptr);
  12. return 0;
  13. }
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
     double 123.000000 'ez'
long double 123.000000 'ez'