My task is to get long
numeric value from part of char[]
, where I have the index of its begining and ending. I am just learning C, so it is confusing to me which function works the best in my case..
Lets say im making function 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]}
}
I would like to know the best method and easiest method to do this. Any other comments are much appreciated too.
We give the algorithm, you write the code. Agree?
OK, so the logic should be