typedef block

给同一种类型的block定义一个别名

typedef int (^MyBlock) (int , int);

int main(int argc, const char * argv[]) {
@autoreleasepool {
MyBlock sumBlock = ^(int a , int b){
return a + b;
}; int i = sumBlock(2,3);
NSLog(@"%d",i); MyBlock avgBlock = ^(int a , int b){
return (a + b) / 2;
};
int k = avgBlock(10,30);
NSLog(@"%d",k);
}
return 0;
}
上一篇:2018牛客网暑期ACM多校训练营(第三场) H - Shuffle Cards - [splay伸展树][区间移动][区间反转]


下一篇:Asp.net core Identity + identity server + angular 学习笔记 (第一篇)