将data中的每一个数,拎出来放到数组t中:
char *data = "123456";
int t[6];
int len = strlen(data);
char buf[6];
for (size_t i = 0; i < len; i++) {
strncpy(buf, data + i, 1);
t[i] = buf[0] - '0';
}
更多推荐
C语言 取字符串中的某个字符
发布评论