why we need function pointers?
Answers were Sorted based on User's Feedback
Answer / kirankumaryakkala
a pointer that holds the address of a function.
in writing the interrupt service routines(isr),memory virus
programs, etc..
as simply, if u wanna execute one function out of two or
more funcitons( the selection based dynamically)
ex. int add(int a, int b)
int sub(int a, int b)
int mul(int a, int b)
int (*ptr)(int a, int b) //function pointer declaration to
hold a function that takes two integers, returns one integer
here,
ptr= it can assign any function name that is going to execute
| Is This Answer Correct ? | 11 Yes | 2 No |
Answer / naman patidar
Apart from above mentioned usage function pointer are used
by event listeners and callback utilities in multi threaded
applications.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / gajendra
Function Pointers are pointers, i.e. variables, which point to the address of a function. You must keep in mind,
that a running program gets a certain space in the main-memory. Both, the executable compiled program code
and the used variables, are put inside this memory.
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a program for the following series: 1*3*5-2*4*6+3*5*7-4*6*8+.................up to nterms
Print the foll in C...eg when n=5 the o/p must b + + + + + + + + + + + + + + + + +
Which is more efficient, a switch statement or an if else chain?
How many types of operator or there in c?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
A program to write a number of letters and numbers, such as counting and display
If the size of int data type is two bytes, what is the range of signed int data type?
What is a static variable in c?
How to add two numbers with using function?
Why the use of alloca() is discouraged?
Method Overloading exist in c ?
Define Spanning-Tree Protocol (STP)