[ create a new paste ] login | about

Link: http://codepad.org/9ZKpffne    [ raw code | output | fork ]

C, pasted on Sep 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
 
int (*add(int x))(int){
  int helper(int y){
    return x + y;
  }
  return helper;
}
 
int main(){
  int (*add2)(int) = add(2);
  printf("%d",add2(3));
  return 0;
}


Output:
1
5


Create a new paste based on this one


Comments: