I want to convert string of multiple decimal numbers, into float. In my case, when the program starts, the user is asked to write some numbers, and it's saved into array (payment), but I need to work with these numbers after that. What's the right way to do it?
EDIT: The main problem is that I don't know how to read a sequence of those numbers, e.g. Insert payment: "1 2 3", I want my result to be 1 2 3 and my actual result is just 1.
This is my code.
int main(){
char payment[100];
printf("Insert money for payment: ");
fgets(payment,100,stdin);
printf("Insert money for payment: %s\n", payment);
return 0;
}
Thank you in advance