Created
April 18, 2013 00:54
-
-
Save yuuichi-fujioka/5409014 to your computer and use it in GitHub Desktop.
function pointer example
This file contains hidden or 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 (*FUNC)(const char*); | |
void printmsg(const char* msg) { | |
printf("print message is '%s'\n", msg); | |
} | |
int main(int argc, char** argv) { | |
FUNC f = &printmsg; | |
f("helloworld"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment