Skip to content

Instantly share code, notes, and snippets.

@desg
Created June 7, 2012 00:54
Show Gist options
  • Save desg/2885799 to your computer and use it in GitHub Desktop.
Save desg/2885799 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
struct list {
int val;
struct list *next;
};
list *map(list *list, int (*fn)(int))
{
typedef struct list list;
list *first = new list;
first->next = list;
first->val = val;
return first;
}
int main()
{
fn = &square;
}
int square(int n) {
return n * n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment