Subj : Re: Use of Function pointers To : comp.programming From : Richard Heathfield Date : Fri Jul 15 2005 03:11 pm ravikumar.n@sunlux-india.com wrote: > > Hi All, > I am Ravi Kumar.N, I have an issue regarding function pointer. > > 1) What is the advantage of using function pointers. They're good for pointing at functions. This is handy if you want to decide at runtime when and where to call which functions, rather than have the knowledge hardwired into your code at compilation time. > > 2) What is the difference between an ordinary function call and calling > a function through function pointer. None. They are executed in precisely the same way, and the syntax can be identical if you choose (at least, in the languages I know of that support them). > 3)Where all function pointers can be used. Callbacks are the canonical example (e.g. see qsort, bsearch), but C++ also uses function pointers, behind a very thin syntactic veil, for implementing private methods, polymorphism, and the like. -- Richard Heathfield "Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk mail: rjh at above domain .