Created
October 29, 2019 14:48
-
-
Save rrmhearts/b6327249b89d39160e940d4a1fa5d4bd to your computer and use it in GitHub Desktop.
Setting a function to a variable in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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