What is the difference between function pointer and pointer to function?why we use static variable as a global instead of defining it a local?

Showing Answers 1 - 2 of 2 Answers

venkatesh

  • Mar 15th, 2006
 

we can create a pointer to function. so we can call the function with that pointer.

eg

let us take two functions

void sum(int a,int b);

void sub(int a,int b);

we can create pointer to these functions

void (*p)(int,int);

p=sum

p(3,2)------gives the sum of two numbers

p=sub

p(3,2) ---gives the difference of two numbers

I am not having that much idea about function pointer.

  Was this answer useful?  Yes

Yash

  • Mar 28th, 2006
 

Both are one and the same thing.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions