假设您有以下方法:
double * myMethod(double (*f)(double[]), double *x, int size)
{
//do something and return
}
为什么我不能写如下?
double * myMethod(double (*f)(double *), double *x, int size)
{
//do something and return
}
用 * 替换 [] ?
假设您有以下方法:
double * myMethod(double (*f)(double[]), double *x, int size)
{
//do something and return
}
为什么我不能写如下?
double * myMethod(double (*f)(double *), double *x, int size)
{
//do something and return
}
用 * 替换 [] ?
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.