Created
July 9, 2010 09:04
-
-
Save Mon-Ouie/469254 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| typedef int (^complicated_block)(int, int); | |
| typedef int (^simple_block)(int); | |
| int main(int argc, char *argv[]) { | |
| complicated_block pow = ^(int n, int power) { | |
| int ret = 1; | |
| for (int i = 0; i < power; i++) | |
| ret *= n; | |
| return ret; | |
| }; | |
| simple_block pow2 = ^(int power) { | |
| return pow(2, power); | |
| }; | |
| printf("2^3 = %d\n", pow2(3)); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment