what is the advantage of function pointer

Answer Posted / tahir ali

As you probably learned in your first programming courses,
pointers to variables allows you to modify variable contents
from a non-local environment. This gives the flexibility of
writing generic functions which do not alter "known" global
variables, but references to "unknown" variables. Such
functions can be reused. Function pointers gives you the
same flexibility, but at a higher level. Instead of calling
a "known" function, one can call any arbitrary "unknown"
function. This is the main advantage of function pointers:
greater flexibility and better code reuse.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain void pointer?

592


Are there any problems with performing mathematical operations on different variable types?

575


Explain high-order bytes.

676


What does the characters “r” and “w” mean when writing programs that will make use of files?

858


What is echo in c programming?

557






What is selection sort in c?

611


What language is c written?

577


Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].

643


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

2455


Explain pointers in c programming?

634


What is #error and use of it?

681


Define recursion in c.

702


Differentiate between declaring a variable and defining a variable?

607


How can I recover the file name given an open stream or file descriptor?

596


plz let me know how to become a telecom protocol tester. thank you.

1742