所以我有一个这样的字符串:
char numbers[] = "123,125,10000000,22222222222]"
这是一个例子,数组中可以有更多的数字,但它肯定会以 ] 结尾。
所以现在我需要将它转换为一个无符号长整数数组。我知道我可以使用 strtoull() 但它需要 3 个参数,我不知道如何使用第二个参数。另外我想知道如何使我的数组具有正确的长度。我想让我的代码看起来像这样,但不是伪代码,而是 C:
char numbers[] // string of numbers seperated by , and at the end ]
unsigned long long arr[length] // get the correct length
for(int i = 0; i < length; i++){
arr[i]=strtoull(numbers,???,10)// pass correct arguments
}
在 C 中可以这样做吗?