Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // sfp = pointer to function that returns char* and takes char* as arg
- typedef char* (*sfp)(char *s);
- // sf = function that returns char* and takes char* as arg
- typedef char* (sf)(char *s);
- char* f1(char *s) {
- printf("f1: %s\n", s);
- }
- char* f2(char *s) {
- printf("f2: %s\n", s);
- }
- main(int argc, char *argv) {
- sfp sfp1, sfp2;
- sf *sf1, *sf2;
- sfp1 = f1;
- sfp2 = f2;
- sfp1("alice");
- sfp2("bob");
- sf1 = f1;
- sf2 = f2;
- sf1("charlie");
- sf2("david");
- }
Add Comment
Please, Sign In to add comment