How do you initialize function pointers? Give an example?
Answers were Sorted based on User's Feedback
Initialisation can be done in the following way.
func(int a,int b);
*pfunc(int a, int b);
main()
{
/*here the starting address of the function can be assigned
to a function pointer of the same type*/
pfunc = func;
....
....
....
}
func(int a, int b)
{
....
....
....
}
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
What are the 32 keywords in c?
Wt are the Buses in C Language
no consistent academics. how to answer the question
How arrays can be passed to a user defined function
In C program, at end of the program we will give as "return 0" and "return 1", what they indicate? Is it mandatory to specify them?
What is the difference b/w main() in C language and main() in C++.
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What are the two types of functions in c?
HOW CAN ADD OUR FUNCTION IN LIBRARY.
how to add numbers without using arithmetic operators.
What is a structural principle?
When should the register modifier be used? Does it really help?