i have a bit of code consisting of an equation that should substract a specific value in an multidimensional string array off of a double-variable and immediately write it back in the double-variable. It's for a uni-project and i tried searching for a solution here which led me strtod() but it doesn't seem to work.
double einwurf;
User can only enter a positive value over 10 for einwurf (this section works)
array
char *getraenkeListe[3][2]={"Wasser", "1.20", "Cola", "1.50", "Kaffe", "1.50"};
the equation is
einwurf=einwurf-strtod(getraenkeListe[getraenkeWahl-1][1], rueckgabewert=-1);
getraenkeWahl can only be 1, 2 or 3
so getraenkeListe[getraenkeWahl-1][1] should give back 1.20 or 1.50
In the example it stated NULL instead of rueckgabewert=-1, but i thought it's just the value it returns when it fails and if something fails in this project we should return a value of -1 so i swapped it out
is it just not possible to reassigne a variable within the strtod()-function? how do i get it in rueckgabewert without writing a new line so the error-value of strtod() won't get lost?
thanks