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
Why can’t constant values be used to define an array’s initial size?
Explain what is wrong with this program statement?
find out largest elemant of diagonalmatrix
What are the 5 types of inheritance in c ++?
Does c have an equivalent to pascals with statement?
What are derived data types in c?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
How many levels deep can include files be nested?
Write a program to swap two numbers without using third variable in c?
explain how do you use macro?
Explain how do you determine whether to use a stream function or a low-level function?
find the sum of two matrices and WAP for it.
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Write a program for Overriding.
What is line in c preprocessor?