Skip to content

Instantly share code, notes, and snippets.

@Sixeight
Created June 10, 2009 08:17
Show Gist options
  • Save Sixeight/127091 to your computer and use it in GitHub Desktop.
Save Sixeight/127091 to your computer and use it in GitHub Desktop.
#include <stdio.h>
struct Greeter {
struct Greeter (*hello)(const char*);
};
struct Greeter hello(const char *name);
struct Greeter initialize()
{
struct Greeter res;
res.hello = hello;
return res;
}
struct Greeter hello(const char *name)
{
printf("hello, %s.\n", name);
return initialize();
}
int main(int argc, char *argv[])
{
struct 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