C++程序设计函数.ppt

// 例3-24 静态变量与自动变量的测试 #include iostream using namespace std ; int func(); int main() { cout func() endl ; cout func() endl ; } int func() { int a = 0 ; // 自动变量 static int b = 1 ; // 静态变量 a ++ ; b ++ ; cout auto a = a endl ; cout static b = b endl ; return a + b ; } 3.6.1 存储特性 // 例3-24 静态变量与自动变量的测试 #include iostream using namespace std ; int func(); int main() { cout func() endl ; cout func() endl ; } int func() { int a = 0 ; // 自动变量 static int b = 1 ; // 静态变量 a ++ ; b ++ ; cout auto a = a endl ; cout static b

文档评论(0)

1亿VIP精品文档

相关文档