5.24

 int lk(2);
    int lk={2};
    int lk{2};

c++新增变量初始化 ;c++存在默认初始化,函数体外部默认0,内部未定义;

extern int a;//声明,不分配内存,在里面完成初始化则变为定义
extern int a(0

外部变量只能定义一次,可以声明多次。

cout<<::ao;//显示访问全局变量
void *s=nullptr;//初始化为空

void *可以用于储存任意对象的地址,但不能直接操作其指向的对象。

const的值在绑定的时候就固定了,即使

     double l1=3.52;
     const int &mm=l1;
     l1=22;
    cout<<mm<<l1;//输出 322

a reference/pointer to constant obj must is const(instead of, const pointer/reference only signify itself const )

obj in ordinary function cannot be declare constexpr ;it only bind to obj who have fixed address;

constexpr int *p;//其他和const一样,但是如果有指针就是 表示地址是const
typedef int w,*ptr;
const ptr q;//q等价于上面的p,const to int *
using Point=Triangle; //新类型替用

*is part of ptr

the usage of auto must have an initializing to ensure type;

auto i=0,*p=&i;

一条语句只能定义一种类型,但是可以包括其指针,不包括const

const int i=0,&i1=i;
auto  a=i;//a is int
decltype(i) b// b is const int
decltype(i1) c//c is const &

decltype 会包含 ref和ptr 和const;

神特么的逻辑 decltype(*p) 是 int &,因为能用、*p更改指向的变量。醉了。
decltype((i)) 总是表示中间值的ref

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值