fork download
  1. #include <stdio.h>
  2.  
  3. void read(char *line) {
  4. float x1 = 0, x2 = 0;
  5. int n = sscanf(line, "%f %f", &x1, &x2);
  6. printf("Read %d, %f %f\n", n, x1, x2);
  7. }
  8.  
  9. int main(void) {
  10. char *line1 = "1.0";
  11. char *line2 = "1.0 2.0";
  12. read(line1);
  13. read(line2);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
Read 1, 1.000000 0.000000
Read 2, 1.000000 2.000000