Today in a C code to see a function of the formal parameter is (int *&a) actually is this thing, which makes me very puzzled ah, do not know with so many address symbols what is the purpose? The address?
That's not necessary, just need to use a pointer to achieve such an effect, ah, exchange of data of two shaping variables, as long as the definition of a function swap (int* a,int *b) in the function to Exchange *a and *b values can be, so that the modification of the parameters and change the role of the arguments ah.
So I went to the library to get a C language grammar books, found that the & symbol is the role of the address, then *& is a what thing, has not seen.
Finally in a C + + book also see & this symbol, actually looked at another usage,"reference" operator. is placed after the type, such as int &a so that & is not the meaning of the address, but also to the formal parameter a reference.
Give me an example, please.
The reference parameter swap (Int&a,int &b) is then called when only swap (A, a, b) can also be used to achieve the role of the address, in fact, the reference parameter to the argument for an alias only, the operation of reference parameters is actually the operation of the arguments.
This usage is not seen in C, has occurred in C + +, through the & operator in C + + to do the use of reference, then to explain the function parameter test seen today (int* &a);
As I've said before,,& is used as a reference, and is placed after the type, which is int* as an shaping pointer type, then int* &a This parameter a represents the int* type reference argument
When using the call, int * a=&b; Test (a); The effect is that manipulating a pointer in the test function is equivalent to the A pointer in the action argument.
Alas, the friend who knows the pointer sees this kind of usage, this many superfluous. It's so complicated.
Said so much, said oneself are foggy, if have a friend to read this article still have not clear, welcome to ask questions, mutual progress.
The formal parameter test (int *&a) of a function in C language?