Identify the incorrect statement.a)Reference is the alternate name of ...
Incorrect Statement: A reference value once defined can be reassigned
Explanation:
Definition of a Reference:
A reference is an alternate name given to an object or variable. It allows us to access the object or variable indirectly using the reference name.
Reassignment of a Reference:
A reference value once defined cannot be reassigned. Once a reference is assigned to a specific object or variable, it remains associated with that object or variable throughout its lifetime.
Understanding Reference:
To understand this better, let's consider an example. Suppose we have a variable called "num" which stores the value 5. We can create a reference "ref" and assign it to the variable "num". Now, "ref" becomes an alternate name for "num", and we can access the value of "num" using the reference "ref". If we try to reassign the reference "ref" to another variable or object, it will result in an error.
Example:
```
int num = 5; // variable num with value 5
int &ref = num; // reference ref assigned to num
ref = 10; // value of num changed to 10
```
In the above example, the reference "ref" is assigned to the variable "num". When we change the value of "ref" to 10, it actually modifies the value of "num" as well. This is because "ref" is just an alternate name for "num", not a separate variable.
Conclusion:
Therefore, the correct statement is option 'C' - A reference value once defined cannot be reassigned. Once a reference is assigned to an object or variable, it always refers to that object or variable and cannot be assigned to another one.
Identify the incorrect statement.a)Reference is the alternate name of ...
Reference is a thing which points to the valid memory address, so it can’t be redesigned.