Skip to content

Instantly share code, notes, and snippets.

@i
Last active December 23, 2015 20:09
Show Gist options
  • Save i/6688016 to your computer and use it in GitHub Desktop.
Save i/6688016 to your computer and use it in GitHub Desktop.
Another example of function pointers in C.
#include <stdio.h>
int add(int a, int b) {
return a + b;
}
int main(int argc, char **argv) {
int ret;
int (*fn_ptr)(int a, int b);
fn_ptr = add;
ret = fn_ptr(3,6);
printf("%d\n", ret);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment