Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-
- * Copyright (c) 2012 valsorym <[email protected]>.
- * All rights reserved.
- *
- * Discussion on the forums.freebsd.org.
- * url: http://forums.freebsd.org/showthread.php?p=177208
- */
- #include <stdio.h>
- void hello(char *);
- void goodbye(char *);
- struct my_struct {
- void (*morning)(char *);
- void (*evening)(char *);
- };
- const struct my_struct courtesy = {
- .morning = hello, .evening = goodbye
- };
- int
- main(int argc, char **argv)
- {
- printf("Somewhere early in the morning.\n");
- courtesy.morning("freethread");
- printf("\nAfter a while, on the border of Mexico.\n");
- courtesy.evening("freethread");
- return 0;
- }
- void
- hello(char *name)
- {
- printf("Howdy %s.\n", name);
- }
- void
- goodbye(char *name)
- {
- printf("Adiós mi amigo %s :)\n", name);
- }
- /* The End. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement