[C++] Tip for Reference

References have to be initialized, and will represent the variables assigned to them.

int x=10,y=5;

//wrong
int &A;
A=x;

//right
int &A=x;

//set x's value by y
A=y;

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *