Hi All,

Can anybody explain here what is the different between normal function call and function to pointer call?

How function to pointer is working internally?

Why should we use function to pointer in call back? why not we call function call directly?


Please pardon me ,if it is very silly


Thanks

Yuvi

I didnt get what you mean by function to pointer but let me explain something:

1- If you pass an arguement to a function without using pointer you pass it by value. In that function if you change the arguements value, when you get back from that function the value of the arguement will not change.

You cannot modify the value if you dont pass it as a pointer.

2-If you pass the arguement as pointer you may modify it if you want. If you pass arguements as pointers to a function it is called call by reference. You pass the adress of the variable and function knows the adress of the variable. So function is capable of changing the value of the variable of the specified adress.

If you want to master pointer( means if you want to program in C ) you may try char pointers to manipulate strings.

Pointers are hard, entertaining, dangerous and a must.

Sorry for my poor english,

I am asking what is difference between pointer to function call and normal function call.

How pointer to function is working

There is not much difference between these too... in the way the calls occur and all, however function pointers provide an easy way to select a function to execute based on run-time values.

The main thing is that if you want to call a function directly you have to know how to spell its name at the time when you write the code. To call a function via a pointer to it, your code can just dereference the pointer and call the result: The code adapts at run time. That is why they are used for callbacks.

This article has been dead for over six months. Start a new discussion instead.