//
// main.m
// Test
//
// Created by herobin on 16/1/11.
// Copyright © 2016年 herobin. All rights reserved.
//
typedef void(^Block1)();
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
int a=100;
NSLog(@"a=%d,add=%p",a,&a);
Block1 myblock = ^() {
NSLog(@"a=%d,add=%p",a,&a);
};
NSUInteger
myblock();
NSLog(@"a=%d,add=%p",a,&a);
void(^myblock2)(int b) = ^(int b) {
NSLog(@"b=%d,addr=%p",b,&b);
};
myblock2(a);
__block int m=1000;
Block1 myblock3 = ^() {
m=10;
NSLog(@"m=%d,add=%p",m,&m);
};
myblock3();
NSLog(@"m=%d,add=%p",m+1,&m);
}
return 0;
}
|
|