p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "Hiragino Sans GB"; color: #e44448 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "Hiragino Sans GB"; color: #e3e3e3; min-height: 21.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "Hiragino Sans GB"; color: #e3e3e3 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "Hiragino Sans GB"; color: #c2349b }
p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px "Hiragino Sans GB"; color: #93c86a }
span.s1 { color: #d28f5a }
span.s2 { }
span.s3 { color: #c2349b }
span.s4 { color: #8b84cf }
span.s5 { color: #e3e3e3 }
span.s6 { color: #93c86a }
span.s7 { color: #00afca }
span.s8 { color: #e44448 }
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;
}