So I'm working on this assignment for my class and book is REALLY unclear about how to use the argc, argv, and atof() items (which are all new to me), so I am trying to use them but I am getting this error, and I'm not quite sure how to correct it:
This is my Error:
error: cannot convert ‘char**’ to ‘const char*’ for argument ‘1’ to ‘double atof(const char*)’
This is my Code:
int main(int argc, char** argv)
{
//Code removed
//Code removed
float *feet = atof(argv); // <-- it says the error is with this line
//Code removed
return 0;
}
float convertFeet(float feet)
{
float meters = feet * .3048;
return meters;
}
The "purpose" of this program is to convert given feet into a float, and then display those (while also converting them to meters). I already know the convertFeet() function works as I tested it before adding the atof(), argc, & argv portions of the program. If anyone could help me understand this error better and the solution that would be very helpful!
Thanks again,
-Stephen
P.S. This is for sure a compile error as my compiler told me. I just didn't post that portion of the error as I considered that portion of the code to be superfluous.