0

假设您有以下方法:

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
}

用 * 替换 [] ?

4

1 回答 1

1

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.

于 2012-05-04T08:49:11.490 回答