Can anyone advise on a simple way of converting a csv string to an array of floats in C?
e.g.
char my_string[] = "1.0,2.0,3.0";
to:
my_array = [1.0, 2.0, 3.0]
where my_array is of type float[]
I would use sscanf as a quick and easy solution but I don’t know how many values are contained in the string in advance
Is there some existing library function that could do this without me having to resort to looping over every char looking for a “,”?
You could use
strtok():