suppose you have the following method:
double * myMethod(double (*f)(double[]), double *x, int size)
{
//do something and return
}
Why can't I write as follows?
double * myMethod(double (*f)(double *), double *x, int size)
{
//do something and return
}
replacing the [] with * ?
You can, but because arrays deprecate the pointers, they actually have the same signature, so if you're getting an error it's because you're trying to redefine the function:
http://ideone.com/E1Z7B works because I renamed the second function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.