Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of function pointer in C

Tags:

c

What is the advantage of passing a function as an argument to another function when we can use the function just by calling that function.

like image 235
sekhu cool Avatar asked Jul 09 '26 00:07

sekhu cool


1 Answers

It's one way to simulate polymorphism and/or callbacks.

A program or client may benefit from client entry points in some contexts. This is a common way to achieve that. It can be used improve modularity or improve physical separation of multiple implementations.

like image 84
justin Avatar answered Jul 10 '26 14:07

justin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!