Reference variables

Reference variable behave similar to both, a value variable and a pointer variable. Value variable are used to hold some numeric values, pointer variable are used to hold the address of some other variable. In programme code reference variable is used similar to that of a value variable but has an action of a pointer variable." Reference variable benefits from the simplicity of the value variable and power of pointer variable". It does provide the flexibility supported by the pointer variable, unlike pointer when a reference is bound to a variable, then its binding cannot be changed. All the accesses made to the reference variable as same as to the access to which it is bound. The general format of declaring reference variable is:

 

Data type and reference variable + value variable

Where data type can be standard or user defined type:

Like Int, char, float etc.

& reference operator

The reference variable must be initialized to same variable only at the point of its declaration. Initialization of reference variable following its declaration sources compilation error.

 




 

   Related Questions in Programming Languages

  • Q : What is Control structure Control

    Control structure: A statement which affects the flow of control in a method. The typical control structures are if statements and loops.

  • Q : Define the term Scheduler Define the

    Define the term Scheduler: The portion of the Java Virtual Machine (abbreviated as JVM) which is responsible for managing the threads.

  • Q : What do you mean by Class variable What

    What do you mean by Class variable: It is a synonym for the static variable.

  • Q : Define Unconditional Jumps

    Unconditional Jumps: Jumps which are not strictly upwards in the block hierarchy can require extensive control-flow manipulation, including creation of redundant code, and should be avoided if possible. Such jumps add considerable modeling overhead fo

  • Q : Describe Software reuse Software reuse

    Software reuse: It is the ability to reuse software components in various contexts. The object-oriented languages aid to encourage reuse by their support of encapsulation.

  • Q : Describe Uninitialized variable

    Uninitialized variable: It is a local variable which been declared, however has had no value allocated to it. The compiler will warn of variables that are employed before being initialized.

  • Q : What is First in-first out First in,

    First in, first out: It is FIFO semantics of the queue data structure. Items are eliminated in the order in which they arrived in the queue; therefore older items are always eliminated before newer ones.

  • Q : State the term tombstone lifetime

    State the term tombstone lifetime attribute?

  • Q : Overriding a base class method in

    Explain the way to overriding a base class method in Visual Studio .NET and in Visual Studio 2005.

  • Q : Main purpose of Child Header files

    Illustrate what is the main purpose of Child Header files?

©TutorsGlobe All rights reserved 2022-2023.