In this section, you will learn how to use 'Pointer' function in C.
C provides a special feature of pointer to a function. As you know that every function defined in C language have a base address attached to it. This base address acts as an entering point into that function. This address can be stored in a pointer known as function pointer. The pointer to a function is the declaration of pointer that holds the base address of the function. The declaration of a pointer to a function is:
return_type (* pointer_name) ( variable1_type variable1_name , variable2_type variable2_name , variable3_type variable3_name .................);
You can see in the given example, we have create a function mul to find the product of three numbers. Then we have declared the function pointer for storing the base address of function mul in the following way:
int (*function_pointer) (int,int,int);
Here is the code:
Output will be displayed as:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.