我的任务是从 的一部分中获取long
数值char[]
,其中我有它的开始和结束的索引。我只是在学习 C,所以我很困惑哪个函数在我的情况下效果最好..
可以说我正在制作功能getNum()
:
static char words[100000]; //lets say this is string filled with many num. values and other stuff.
long getNum(int begin, int end){
return (long){part of string starting at words[begin] and ending at words[end]}
}
我想知道最好的方法和最简单的方法来做到这一点。任何其他评论也非常感谢。