Pointer to function

Joined
Jan 29, 2011
Messages
3
Reaction score
0
Why we use function pointers?

Eg:
Roughly I written the code for understanding purpose only...

char (*ptr_fun)(); // pointer to a function which returns char
char fun();
char ch;
ptr_fun = &fun; // assign the address of that fun to that pointer


Now the question is, what is the different between the below two function call even though both perform the same operation
ch = fun();
ch = *ptr_fun;

Kindly explain why the function pointers are used and what are the situations it required.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top