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