Function Pointer in C

Function Pointer in C


 A function pointer is like a note that holds the location of a function instead of holding data.

 A function pointer is a special kind of pointer that stores the address of the function.

 It allows you to call a function indirectly through the function.

 The function pointer holds the memory address of the function instead of the data.

Syntax of Function Pointer in C 

 Return type(*function pointers variable name)(parameters);

int(*func)(int a,int b);

Program for Function pointer in C 

 // Program for Function pointer in C
// Function declarations
int add(int A, int B);

int main() {
// Declare a function pointer for functions taking two ints and returning int
int (*C)(int, int);
C = add;
int sum = C(5, 3);

printf("Result of add function: %d\n", sum);
return 0;
int add(int a, int b) {
return a + b;

Result of add function: 8

Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments