What is the funition pointer and where we use it?

Status
Not open for further replies.

dayal

Member level 3
Joined
Aug 26, 2007
Messages
54
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,629
hi,

can anyone tell me, what is the funition pointer and where we use it , awaiting ur kind reply.

thanks
dayal
 

Re: funtion pointer

Function pointer is the functions name.
It is mainly used when we are using an API that takes a function prototype as an argument. This is very common when creating a task, a thread, or a process in my applications. Another example when registering an ISR or a call back.
--
Amr
 

Re: funtion pointer

expanding upon amraldo's reply.


function pointer is used when we don't (need to) know the name of the function in advance.
Just like an int pointer, where it can point to any int, a function pointer can point to any function with the same signature (i.e. return type and parameters).
We can use typedef to declare a function pointer type and use that for passing functions as parameters to functions (for ISR, Callbacks, task entry point, signal handler) in a easily readable way.

Function pointers allow a lot of flexibility in code development and creating libraries without knowing the exact end product.

And Google is not bad in telling about that!
 

funtion pointer

A function pointer is pointer which can hold the address of any function but with same arguments and return type.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…