-
-
Save kana/127218 to your computer and use it in GitHub Desktop.
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 struct Greeter | |
{ | |
struct Greeter (*hello)(const char*); | |
} Greeter; | |
Greeter hello(const char *name); | |
Greeter | |
initialize() | |
{ | |
Greeter res; | |
res.hello = hello; | |
return res; | |
} | |
Greeter | |
hello(const char *name) | |
{ | |
printf("hello, %s.\n", name); | |
return initialize(); | |
} | |
int | |
main(int argc, char *argv[]) | |
{ | |
Greeter me = initialize(); | |
me.hello("yaotti"). | |
hello("satzz"). | |
hello("hmsk"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment