2.7 指派運算子
¶基本指派 =
= 用來把右邊的值指派給左邊的變數:
#include <iostream>
using namespace std;
int main() {
int x;
x = 10; // x 現在是 10
x = 20; // x 改成 20
x = x + 5; // x 現在是 25
cout << x << endl;
return 0;
}
執行結果: