流浪のwolf

卷帝

导航

C++中左值和右值的区别

#include <iostream>

using namespace std;
// 什么是左值和右值 const 可以修饰左值和右值z
// 左值:有地址的变量
// 右值:没有地址的变量 比如 立即数,常量字符串 string
// 常引用的意义:代码的安全和稳定
int main()
{
    cout << "Hello World!" << endl;
    return 0;
}

 

posted on 2024-03-02 21:28  流浪のwolf  阅读(2)  评论(0编辑  收藏  举报