0
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->keys[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

3 Answers 3

2

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

struct return_values* values = function(&ptr->keys[pos]); 
Sign up to request clarification or add additional context in comments.

1 Comment

i changed the it to function(&(ptr->keys[pos])); but now i get an error error: incompatible type for argument 1 of `function' how to change my function declaration so that i can send the address to it
1

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

Comments

0

Change

struct return_values* function(struct classifier fun_ptr)

to

struct return_values* function(struct classifier *fun_ptr)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.