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 |
What is C language Terminator?
f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p) printf("%s",p); } what is the output?
9 Answers Hughes, Tech Mahindra,
IS STRUCTURES CAN BE USED WITHIN AN ARRAY?
Are pointers really faster than arrays?
what are the advantage of pointer variables? write a program to count the number of vowels and consonants in a given string
what is the function of .h in #include<stdio.h> in c ?
23 Answers HCL, IBM, Wipro,
Explain heap and queue.
What is null pointer in c?
EXPLAIN #INCLUDE<STDIO.H> EXPLAIN #INCLUDE<CONIO.H>
Is there a way to compare two structure variables?
how can make variable not in registers
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures