//
// main.m
// Block
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef int (^MySum) (int, int);
void test1(){
int (^Sum) (int, int) = ^(int a, int b){
return a + b;
};
NSLog(@"%i", Sum(2, 3));
}
void test2(){
MySum sum = ^(int a, int b){
return a + b;
};
NSLog(@"%i", sum(10, 2));
}
int main(int argc, const char * argv[])
{
@autoreleasepool {
test1();
test2();
}
return 0;
}
OC得Block语法使用
最新推荐文章于 2023-03-19 22:28:49 发布