Joke Collection Website - Mood Talk - In C++, what's the difference between quoting and taking an address?

In C++, what's the difference between quoting and taking an address?

First, the functions are different.

1. Reference: used to pass values.

2. Address extraction: used to extract the first address.

Second, the operation is different.

1. reference: Addressing a reference means addressing the target variable. & ampRa and&; A equals. That is to say, the reference name is an alias of the target variable name.

2. Address fetch: the operation of returning a pointer, the value of which is the address opened when P was declared at that time, and the type of the pointer is the pointer type corresponding to the type of P. ..

Third, the characteristics are different.

1. reference: after the reference declaration is completed, it means that the target variable name has two names, namely the original name of the target and the reference name, and the reference name can no longer be used as an alias for other variable names.

2. Address: Use&; When an operator accepts an address, it can be compiled without any coercion.

Baidu encyclopedia-&

Baidu Encyclopedia -C++ citation