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

流浪のwolf / 2024-03-03 / 原文

#include <iostream>

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