How do you initialize function pointers? Give an example?

Answer Posted / preeti singh

for e.g. if we have to declare a pointer to a function , the
signature of which is :
int add(int a,int b)

then a pointer to the above function can be declared as:
int (*myptr)(int ,int);

here myptr is a pointer which can point to any function that
takes 2 int args and returns an int value.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1315


How is a structure member accessed?

594


Why c is faster than c++?

641


What does 4d mean in c?

961


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

646






What is static volatile in c?

585


Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon

5470


How do I use strcmp?

651


using for loop sum 2 number of any 4 digit number in c language

1747


can we have joblib in a proc ?

1664


What is a floating point in c?

614


Why is c called a structured programming language?

694


What is spark map function?

589


How to create struct variables?

601


Is there a way to compare two structure variables?

621