Hi,
please can you tell me use of function pointer and its advantage.
Thanks,
Akhil
function pointer is,as it's name tells, a pointer to a function.By using file pointers u can make ur code shorter and more readable.
Nice example of function pointer is a function pointer which is used for navigating trough some type of menu.
e.g
void (*pfunc) (int *x,int *y);//<-Function pointer
void incy(int *x,int *y);//Function whcih increase y
void decy(int *x,int *y);// decreases y
void incx(int *x,int *y);
void decx(int *x,int *y);
//Code to determine which key is pressed
........
e.g
case UPKEY: pfunc=incy;
and so on.
Also f.ptrs are not declared,they "steal" declarations from function which they point to.
Savage