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

how can f be used for both float and double arguments in printf? Are not they different types?

618


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

1545


Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

2566


How do I create a directory? How do I remove a directory (and its contents)?

613


What is time complexity c?

578






Define the scope of static variables.

612


What is the purpose of main( ) in c language?

632


How many bytes are occupied by near, far and huge pointers (dos)?

682


Explain what are reserved words?

644


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

612


Why do some versions of toupper act strangely if given an upper-case letter?

642


Why pointers are used?

639


Why c is faster than c++?

639


What language is windows 1.0 written?

585


What are the key features in c programming language?

624