From definition double strtod ( const char * str, char ** endptr );
C reference sites provide an example for that mighty function:
char szOrbits[] = "365.24 29.53";
char * pEnd;
double d1, d2;
d1 = strtod (szOrbits,&pEnd);
d2 = strtod (pEnd,NULL);
If endptr should be of type char ** why is char *pEnd used here ? And not char **pEnd ?
The type of
pEndischar *. The type of&pEndischar **.C passes arguments to functions by value, so to modify a pointer you need to pass a pointer to the pointer.
You could define a
char **directly but you would need to initialize it to achar *as the idea is thatstrtodis modifying achar *.Like:
Obviously the intermediate
ppointer is not necessary and you can use&qdirectly.