Reference type definition:
INT IVAL = 1024; INT & REFVAL = IVAL; // RightInt & Refval2; // Error. It Must Be Initialized
The reference type is different from the pointer:
INT & REFVAL = & IVAL; // Error
INT * PTR = & IVAL;
INT * & refval2 = Ptr; // Right. Refval2 is a reference to the pointer
Once defined, the reference type can no longer point to other objects, such as:
INT min_val = 0;
Refval = min_val; //, the value of IVAL is modified to 0 instead of refval pointing min_val
In fact, the reference type is equivalent to an alias alias
Real C programmers rarely use the reference type to independent object, the reference type is mainly used as a function of the function. such as
BOOL GET_NEXT_VAL (INT & NEXT_VAL);
Matrix Operator (Const Matrix &, Const Matrix &);