Passing Pointers to Functions

Learn to use pointers to functions, and also learn how pointers can be used to pass arguments to a function by reference and how that lets us alter variables outside the function's scope.

Pointers to functions

One of the handy things you can do in C, is to use a pointer to point to a function. Then you can pass this function pointer to other functions as an argument, you can store it in a struct, etc. Here is a small example:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy