跳至主要內容

17.C++存储类

约 117 字小于 1 分钟

存储类定义 C++ 程序中变量/函数的范围(可见性)和生命周期。这些说明符放置在它们所修饰的类型之前

存储类

auto
register
static
extern
mutable
thread_local (C++11)

auto 存储类

auto f=3.14;      //double
auto s("hello");  //const char*
auto z = new auto(9); // int*
auto x1 = 5, x2 = 5.0, x3='r';//错误,必须是初始化为同一类型

register 存储类

register 存储类