标签:int 模式 ati bsp font har return main 静态变量
C语言里面的
静态变量
静态全局变量
全局变量
其中静态变量和普通变量的截取模式是一样的,只是因为他赋值不被丢弃,所以能修改成功
code:
#import <Foundation/Foundation.h>
int global_val = 1;
static int static_global_val = 2;
int main(int argc, const char * argv[]) {
@autoreleasepool {
static int static_val = 3;
void (^blk)(void) = ^{
global_val = 5;
static_global_val = 10;
static_val = 20;
};
blk();
NSLog(@"global_val = %d", global_val);
NSLog(@"static_global_val = %d", static_global_val);
NSLog(@"static_val = %d", static_val);
}
return 0;
}
标签:int 模式 ati bsp font har return main 静态变量
原文地址:http://www.cnblogs.com/sanjianghuiliu/p/6533215.html