我期待b的值爲100以下,但我得到12。爲什麼會出現這種情況?顯然,我的c = b
行不是將c指定爲b的別名?設置第二個變量的參考
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int a = 4;
int b = 12;
int& c = a;
c = 8;
cout << a << endl;
c = b;
c = 100;
cout << b << endl;
int bb;
cin >> bb;
return 0;
}