Top Answer
User Avatar
Wiki User
Answered 2013-08-04 05:00:30

An alias is a reference, an alternate name for a variable or constant. You can assign the address of any variable or constant to a reference of the same type. A reference is a bit like a constant pointer to the type but, unlike a pointer, a reference has no address of its own thus you cannot store references. More importantly, references can never be NULL. They are simply an alternative name by which you can refer to an existing variable or constant. When you assign a value to an existing reference to a variable, you are assigning the value to the variable itself. When you pass a reference to a function, you are passing the address of the value being referred to, and that address is assigned to the function's reference argument and is local to the function. This is not unlike passing a pointer, but pointers may be NULL, references are guaranteed to be non-NULL (a NULL reference invalidates your program).

Note that C++ references are not the same as C reference variables or constants. In C, a reference variable is simply a non-const pointer, while a reference constant is a constant pointer. Hence pointers can be dereferenced (both in C and C++). But in C++, a reference is neither a variable nor a pointer, but is constant (it always refers to the same object and cannot be reassigned once assigned).

User Avatar

Your Answer

Related Questions

A reference is an alias for a variable. Unlike a pointer variable, which must occupy memory in order to store the memory address of the object it points to, a reference consumes no memory other than that used by the object it references. An array name is a typical example of a reference. It is an alias to the memory allocated to the array.

Declare the type (int, char, double, etc) followed by the name of the variable. The variable name is a reference to the memory allocated to the type being declared. If the variable is a pointer to the type, precede the name with *. In C++, you may also initialise variables in the declaration.

I can tell you that it is not an illegal variable name in C. I do not currently have a C++ compiler installed, but I would assume that it would also be valid in C++.

No. Pass by value always receives a copy of the value being passed. Even if it were possible to physically pass a user-defined identifier into a function by value, the compiled code would not recognise the name since all identifiers are stripped out by the compiler and replaced with memory addresses. Strictly speaking, even pass by reference does not pass the variable name, as the function argument is simply an alias, an alternate but informal name, for the formal name you actually pass. In essence you are passing the memory address of the variable, rather the value of the memory address as you would with pass by value.

A variable is any named value of a specified type that can hold any value of that type, and that can change that value at any time while the name is in scope. A constant is exactly the same as a variable except that its value must be set at the point of instantiation and the given value cannot be altered while the name remains in scope. In other words, a variable is a value that may vary while a constant is a value that always remains the same.

A good variable name is one that is clear, related to the data it stores. Also, you should try to avoid confusions with other variables.

A variable is a named memory location for which the contents are volatile. The antonym of variable is constant.

What is the variable of x plus 10 plus 4x-35?

The given expression can be simplified to: 14k-12

If you mean -6+4x-5 then the given expression can be simplified to 4x-11 and the unknown variable is x

It is not a reserved word, so can be an identifier (name of a type/variable/function).

In the statement given in the question, m is a variable with an unknown value.

A constant is a variable that does not change. The correct term is constant variable.

Use a character variable. For example: plus = '+' minus = '-' You can now refer to these symbols using the variable names "plus" or "minus".

In php a variable is declared using $ sign for eg. $name or $sport= 'Volleyball';. If you are not using this sign it won't work.

d is the variable here.

A hidden global variable must be one that has its scope blocked by a local variable of the same name. To access the hidden variable, use the scope resolution operator ::, such as is ::variable_name. If there is another reason for the hidden status, please clarify and restate the question.

type variable {[optional array size]} {= optional initializer};

It is impossible to give any decimal/numeric value if we are not given the values of at least one variable, so the answer is B + B + B + C + C + C.

A variable is a place to store a value that may change while the a program runs.

Not initialized variable: int myInt; Initialized variable: int myInt = 10;

A static member variable is local to the class rather than to an object of the class.

The given expression can be simplified to 4x-1018 and the value of x is an unknown variable.

It is an expression with a variable, x.It is an expression with a variable, x.It is an expression with a variable, x.It is an expression with a variable, x.

There are 5 type of variables in C++....