2012-03-02 259 views
0

当试图分配函数指针时,我有一个左值操作数问题。我不知道问题出在哪里,但我会给你所有与这个特定问题有关的代码。作为赋值左操作数所需的左值(不是“使用==”)

double *func(double); //initialization for a pointer to a function that both returns a double and requires a double 

    func = &xsquaredsinx; //trying to make the pointer point at a function that both returns a double and requires a double 
    func = &halfcircle;//others that are the same 
    func = &testfunction; 

任何帮助将是美好的。

回答

3

func的声明语法不正确;该声明声明了一个函数,该函数需要double并返回double*。声明func正确的方法是:

double (*func)(double); 
+0

非常感谢你。这是确切的问题,现在它已经修复了。两个小时的简单语法错误:P非常感谢你! – user1244140 2012-03-02 03:01:03

相关问题