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 : Define the term Manifest file Define

    Define the term Manifest file: It is a file which is held in a Java Archive (JAR) file, explaining the contents of the archive.

  • Q : Define Propagation Propagation : When

    Propagation: When an exception is thrown in a method, and there is no suitable exception handler within the method, the exception might be propagated to the caller of the method. For a checked exception, the method should include a throws clause in it

  • Q : What is Native method Native method :

    Native method: In native method, the method is written in a language other than Java, however accessible to a Java program. Native methods are far away from the scope of this definition.

  • Q : What is Class body Class body : It is a

    Class body: It is a body of class definition. The body collects the definitions of a class's members that is, methods, fields and nested classes.

  • Q : Content of a course in Moodle Normal 0

    Normal 0 false false

  • Q : How would you extract an exact

    How would you extract an exact attribute by using XSLT, from an element into an XML document?

  • Q : What is Datagram Datagram : It is a

    Datagram: It is a packet of information passed between the two communicating procedures across a network. Both the Transmission Control Protocol (abbreviated as TCP) and the User Datagram Protocol (abbreviated as UDP) are indirectly comprised in sendi

  • Q : How can I get an exact image in a web

    How can I get an exact image in a web page?

  • Q : Explain way to open one resistance of

    Explain the way to open just one resistance of vb application (.exe).

  • Q : Program is prone to deadlock when

      Give a brief introduction about the operation of your program and show that you understand the idea behind threads and mutual exclusion variable. Why do we need to use mutual exclusion to control the access of the three global variables? What is the potential p

©TutorsGlobe All rights reserved 2022-2023.