Q:

What is the use of function pointers?

Possible Duplicate:
What is the point of function pointers? 

I am trying to understand where in the practical scenarios function pointers are used.
and also can anyone please give me a practical example where we have to pass function itself as an argument to another function.

A:

Function pointers can be useful when you want to create callback mechanism, and need to pass address of a function to another function.
They can also be useful when you want to store an array of functions, to call dynamically for example.

A:

Callback routines appear to be the most common scenario put forth thus far.  However, there are many others ...
Finite State Machines where the elements of (multi-dimensional) arrays indicate the routine that processes/handles the next state.  This keeps the definition of the FSM in one place (the array).
Enabling features and disabling of features can be done using function pointers.  You may have features that you wish to enable or disable that do similar yet distinct things.  Instead of populating and cluttering your code with if-else constructs testing variables, you can code it so that it uses a function pointer, and then you can enable/disable features by changing/assigning the function pointer.  If you add new variants, you don't have to track down all your if-else or switch cases (and risk missing one); instead you just update your function pointer to enable the new feature, or disable the old one.
Reducing code clutter  I touched upon this in the previous example.  Examples such as ...
switch (a) {
case 0:
    func0();
    break;
case 1:
    func1();
    break;
case 2:
    func2();
    break;
case 3:
    func3();
    break;
default:
    funcX();
    break;
}

Can be simplified to ...
/* This declaration may be off a little, but I am after the essence of the idea */
void (*funcArray)(void)[] = {func0, func1, func2, func3, funcX};
... appropriate bounds checking on 'a' ...
funcArray[a]();

There are many more.  Hope this helps.

A:

One common use is to implement a callback function. 
Try to sort something by using qsort library function. It's last parameter is a pointer to the comparator function written by you.

