Skip to content

Instantly share code, notes, and snippets.

@rrmhearts
Created October 29, 2019 14:48
Show Gist options
  • Save rrmhearts/b6327249b89d39160e940d4a1fa5d4bd to your computer and use it in GitHub Desktop.
Save rrmhearts/b6327249b89d39160e940d4a1fa5d4bd to your computer and use it in GitHub Desktop.
Setting a function to a variable in C
#include <stdio.h>
typedef void (*functionType)();
void doThis() {
printf("Hello World!\n");
}
int main() {
functionType doVar = &doThis;
doVar();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment