# What is double address operator(&&) in C++?

C++Server Side ProgrammingProgramming

&& is a new reference operator defined in the C++11 standard. int&& a means "a" is an r-value reference. && is normally only used to declare a parameter of a function. And it only takes an r-value expression.

Simply put, an r-value is a value that doesn't have a memory address. E.g. the number 6, and character 'v' are both r-values. int a, a is an l-value, however (a+2) is an r-value.

## example

void foo(int&& a)
{
//Some magical code...
}
int main()
{
int b;
foo(b);       //Error. An rValue reference cannot be pointed to a lValue.
foo(5);       //Compiles with no error.
foo(b+3);     //Compiles with no error.
int&& c = b;  //Error. An rValue reference cannot be pointed to a lValue.
int&& d = 5;  //Compiles with no error.
}