Skip to content

Instantly share code, notes, and snippets.

@zoek1
Created August 20, 2012 04:18
Show Gist options
  • Save zoek1/3400793 to your computer and use it in GitHub Desktop.
Save zoek1/3400793 to your computer and use it in GitHub Desktop.
Una ejemplo simple de la simulación de una closure en c.
#include <stdio.h>
int (* closure_clang(void)) (int, int){
int suma(int entero, int entero2){
return entero + entero2;
}
return suma;
}
int main(void){
unsigned int j, k;
puts("Introduce un numero");
scanf("%u",&j);
puts("Introduce otro numero");
scanf("%u",&k);
printf ("la suma es: %u \n", (closure_clang())(j,k));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment