-1

I am new to function pointers . I have written a function which can take pointer to a function.

 register_agent( void (*agent)())

I want to pass a pointer of the function

 registry_agent

as a parameter to

 register_agent 

Can anyone pls suggest how do I do this in C. Also explain the concept behind

ro88
  • 59
  • 6

1 Answers1

0

It cant be done in C as you will have an infinite-length function declaration:

void ra(void (*r)(void (*r)(void (*r)(void .......))))

(assuming that you want to declare it giving the parameter list)

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
0___________
  • 60,014
  • 4
  • 34
  • 74
  • 1
    Note that the question asks about two functions with different (but confusingly similar) names: `registry_agent()` and `register_agent()` (`registRY` vs `registER`). And presumably, the register function can be used to register numerous functions, though it is not clear whether they share the same signature or not. – Jonathan Leffler Jul 19 '22 at 20:17