* iceColdFire:
I have a function as
void f(int p)
{
return p++;
}
First, you cannot return non-void when the function is declared
as returning void.
Second, with 'void' changed to 'int', that has the same final effect as
int f( int p )
{
return p;
}
You might want to take a look at
<url:
http://home.no.net/dubjai/win32cpptut/html/w32cpptut_01_02_11.html>
for other reasons why you should avoid postfix increment and decrement.
now I have created a function pointer as
void(**pf)(int);
and initialization as
*pf=f;
but compiler gives error...
The compiler shouldn't flag _that_ as an error, but a good compiler will
warn you that you're derefencing an uninitialized pointer.
Possibly what you wanted was
int (*pf)(int) = f;
However, as a beginner try to avoid using pointers directly. In this case
you would probably (here I'm guessing, but probably) be much better served
by using a virtual member function instead. Try to read up on that.