从左至右还是从右至左

c++17 是从左至右 14是从右至左

  • 从左至右是按照我们的意愿做事情 而从右至左是反过来
bool foo(double& m)
{
    m = 1.0;
    return true;
}
int main(void)
{
    double test = 0.0;
    cout << test << endl;//0
    //取决于编译器
    std::cout << "Value of test is : \t" << test << "\tReturn value of function is : " << foo(test) << "\tValue of test : " << test << std::endl;
    return 0;
}
standard.gif
  • c17是从左至右的 结果都是123
void test123()
{

    char s[] = "123", * p;
    p = s;
    // 1 2 3
    cout << *p++ << endl;
    cout << *p++ << endl;
    cout << *p++ << endl;

}
void test321()
{
    char s[] = "123", * p;
    p = s;
    //321
    cout << *p++ << *p++ << *p++ << endl;

}
int main(void)
{
    test123();//123
    test321();//123
    return 0;
}

你可能感兴趣的:(从左至右还是从右至左)