why we need function pointers?

Answers were Sorted based on User's Feedback



why we need function pointers? ..

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

why we need function pointers? ..

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

why we need function pointers? ..

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

Post New Answer

More C Interview Questions

how to introdu5ce my self in serco

0 Answers  


Add 2 64 bit numbers on a 32 bit machine

3 Answers   EMC, Hyderabad Central University, NetApp,


Three major criteria of scheduling.

1 Answers  


What is variable in c with example?

1 Answers  


What is meant by inheritance?

0 Answers  






What is wrong in this statement?

0 Answers  


mplementation of stack using any programing language

1 Answers   Marlabs,


What is the meaning of this decleration? unsigned char (*pArray[10][10]); please reply.

1 Answers  


How to removing white spces in c programming only bu using loops

2 Answers  


Concat two string with most overlapped substring has to removeĀ  "abcd"+ "cdef" = "abcdef

6 Answers  


what are the general concepts of c and c++

2 Answers  


Explain how can you tell whether two strings are the same?

0 Answers  


Categories