fork download
  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5. int a;
  6. char b[16];
  7. int c;
  8.  
  9. char *p;
  10.  
  11. p = "12,34,56";
  12. sscanf(p, "%d,%s,%d", &a, b, &c);
  13. printf("a=%d, b=%s, c=%d\n", a, b, c);
  14.  
  15. p = "23 45 67";
  16. sscanf(p, "%d %s %d", &a, b, &c);
  17. printf("a=%d, b=%s, c=%d\n", a, b, c);
  18. }
Runtime error #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
a=12, b=34,56, c=-1079624228
a=23, b=45, c=67