Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

what is use of Function pointer

Status
Not open for further replies.

ep.hobbyiest

Full Member level 4
Full Member level 4
Joined
Jul 24, 2014
Messages
212
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
1,487
what is use of function pointer over use of simple function?
i found that it is use for callback function. but not clear to that much.
 

thank you for reply.
I know the declaration and implementation. But i want to know use or application where only function pointer can use.
or use of of function pointer is efficient.
 

Look at the standard library qsort function, without function pointers implementing such a thing for an ADT in C is basically impossible.

Another common use is where you wish to provide a plugin mechanism, here a structure containing function pointers can provide a C++ like inheritance mechanism that can be very useful.
You often see this idiom in device drivers where it is common for all device drivers of a given type to register with the system by supplying a pointer to a structure containing function pointers that implement the required API.

Regards. Dan.
 

Pointer to a function can holds the address of another function. These are used to executing the function by accessing the addressing of the function without disturbing the nature of the function.
i.e indirect calling of the function.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top