c语言实现遍历字符串并分割成数组 发表于 2018-03-13 | 分类于 c 遍历字符串12345678910111213141516171819202122232425262728293031323334int sepcharbydh(char *in, char caOut[200][256]){ char *p, *p2; long lCount; long m = 0; lCount = 0; if (strlen(in) == 0) return 0; p = in; memset(caOut, 0, 200 * 256); while (*p) { if (*p == ',') { caOut[lCount][m] = '\0'; m = 0; p++; lCount++; if (lCount >= 200) return lCount; } else { if (m < 35) { caOut[lCount][m] = *p; p++; m++; } } } return lCount + 1;}