what’s the difference between these signatures?
T * f(T & identifier);
T & f(T & identifier);
T f(T & identifier);
void f(T * identifier);
void f(T & identifier);
void f(T identifier);
I met pointers in c, but the amperstand in function signature is new for me. Can Anyone explain this?
An ampersand in a type declaration indicates a reference type.
References have many similarities with pointers, but they’re easier to use and less error-prone if address arithmetic is not needed. Also, unlike pointers, references can’t be rebound to ‘point’ to another object after their initialization. Just ask google for references vs. pointers in C++.