Home » C Programming » Tutorial »
Function Pointer in C Programming
A function pointer in C programming is a special type of variable which holds the address of a function, this function can be called using that function pointer.
Usage of Function Pointer
- Functions as Arguments to other functions
- Callback Functions
Functions as Arguments to other functions
We can pass functions as arguments to other functions in C programming. The syntax of function pointer is -
void (*fptr)(int);
In the above syntax fptr is a function pointer which can store address of a function which takes one argument int and returns void.
int (*fptr)(int, int);
Here fptr is a function pointer to a function which takes one int argumetns and also return int value.
Example of Function Pointer
Callback Functions
C Tutorial
- History of C Language
- The First Program in C
- Compilation & Execution
- Compile C on Dev-C++
- Compile C on GCC Linux
- Variable & Data types
- Comments
- Storage Classes
- Conidtional Statements
- Switch Cases
- Loops (for, while, do-while)
- Arrays
- Pointers
- Function Pointer
- Strings & Library func
- Formated I/O
- Structure
- Enum
- Union
- File I/O
- Memory Management
- Error Handling
- Type Casting