fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. char *phoneNum = "(515) 555-5555";
  5. char aCode[3+1];
  6. char aNum[7+1];
  7. sscanf(phoneNum, "(%3[0-9]) %3[0-9]-%4[0-9]", aCode, aNum, &aNum[3]);
  8. printf("%s %s", aCode, aNum);
  9. return 0;
  10. }
  11.  
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
515 5555555