I'm working on a project for my class and have come upon a roadblock. Let's say I have a space separated character array (string) that contains numbers (each followed by a space character). Assume it looks something like this:
0 1 15 10 6 2
The number of items in it will never be constant so I cannot use sscaf()
to get all the numbers. I tried looping trough it as characters but I ended up separating the double digit numbers messing things up.
Can someone guide me on how I can get each number in the string and save it to a int array without separating the double digit ones? I'm writing this in C
Thanks in advance