fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main(void) {
  7. // your code goes here
  8. int nCcnt; // char型配列用添え字
  9. int nEinAcnCod[10]; // int型配列
  10. int nIcnt = 0; // int型配列用添え字
  11. char szTmp[64] = {0}; // 作業領域
  12. char szEinAcnCod[64] = "02,03,08,15,17";
  13. char *ptr;
  14. ptr = strtok(szEinAcnCod, ",");
  15. nEinAcnCod[nIcnt] = atoi(ptr);
  16. //printf(%d\n, nEinAcnCod[nIcnt]);
  17.  
  18. while(ptr != NULL)
  19. {
  20. ptr = strtok(NULL, ",");
  21.  
  22. if(ptr != NULL)
  23. {
  24. nIcnt++;
  25. nEinAcnCod[nIcnt] = atoi(ptr);
  26. //printf(%d\n, nEinAcnCod[nIcnt]);
  27. }
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 9288KB
stdin
Standard input is empty
stdout
Standard output is empty