开发者

error after compilation in C

if ((pos < n) && (key == ptr->keys[pos].value))
  {
    struct return_values* function(&ptr->keys[pos]);
  }

while compilation i get the error

 error: syntax error before '&' token in this line 
 struct return_values* function(&ptr->key开发者_如何学编程s[pos]);

i am passing the address of ptr->keys[pos] to the function

struct return_values* function(struct classifier fun_ptr)

where struct return_values is the return type what is the error here h


You need to assign the result of functon to a variable:

struct return_values* values = function(&ptr->keys[pos]);


If you are calling function from there, you don't need to write "struct return_values*" part.


Change

struct return_values* function(struct classifier fun_ptr)

to

struct return_values* function(struct classifier *fun_ptr)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜