Function Pointer is a pointer which points to a function with different names but similar type of parameters. The Functions which performs different operations but still having same parameters as each other at that time function pointer are very useful for accessing functions in a flexible manner.
If there is one function called
addition(int a, int b); & another function RectArea(int length, int width);
These both functions are performing different tasks but still have same parameters.
Now just we have to careful how the Function Pointer will know to call which function
It is done by
void (*function_pointer) (int, int) // Function pointer Declaration
function_pointer = &function_name; // assigning Address of a Function
(*funcation_pointer) (num1,num2); // call to an assinged function.
As per above example
void (*fptr) (int, int);
fptr = &addition; // Call to Addition Function
fptr = & RectArea; // Call to Area of Rectangle Function.
(*fptr) (length, width);
by Adrian McDonald 5 years ago
I'm a film director and screen writer who is currently working on my first film. I would appreciate the input of everyone on this topic. It doesn't matter how absurd your idea may be, many absurdities have revealed truth. If you discredit the existence of the subconscious, then by all means,...
by karzan.ahmad 7 years ago
calculute [(sin x)^1/2]dx?
|HubPages Device ID|
|Login||This is necessary to sign in to the HubPages Service.|
|HubPages Google Analytics|
|HubPages Traffic Pixel|
|Google Hosted Libraries|
|Google AdSense Host API|
|Conversion Tracking Pixels|
|Author Google Analytics|
|Amazon Tracking Pixel|