4
Reply

What is Call By Value and Call By Reference?

Pradeep

Pradeep

15y
19.1k
0
Reply

    Hey Puran,


    Value types are not always stored in stack.
    Value types storing depends upon where they have declared.
    For e.g. The value type member variable of object(class) is strored in heap
    and the value type variable inside the function defination are stored on to the stack.

    Thanks,
    Mahesh

    To understand call by value and call by reference you should have better understanding of data types.

    In .NET Microsoft has divided data types in two parts:

    1. Value Type (Fixed in size)
    2. Reference Type (Not fixed in size)

    In application context, value types are stored in stack but reference types are stored in managed heap.

    Value Type

    • Value types are fixed in size.
    • Value types are made in system stack.
    • Actual values of data are stored in stack.
    • If you assign a value of a variable to another it will create two copies.

    All primitive data type except string and object are example of value types.

    Object is a super type. It can store any type and any size of data. Object is called super type because it helps in inheritance.

    struct and enum are value type.

    Note: Stack is an operation entity (LIFO) i.e. it is fixed in size.

    Reference Type

    • Reference types are not fixed in size.
    • They are maintained in system managed heap but it also uses stack to store reference of heap.
    • Two primitive types (string and object) and non-primitive data types (class, interface & delegate) are examples of reference type.

    CLR manages heap (large memory area). Heap address is accessed from stack. In reference type reference is used for processing using both managed heap and stack (operational entity).

    As per wikipedi
    "Bluetooth is a standard and a communications protocol primarily designed for low power consumption, with a short range (power-class-dependent: 1 meter, 10 meters, 100 meters) based on low-cost transceiver microchips in each device.[5] Bluetooth makes it possible for these devices to communicate with each other when they are in range. Because the devices use a radio (broadcast) communications system, they do not have to be in line of sight of each other.

    More prevalent applications of Bluetooth include:

    • Wireless control of and communication between a mobile phone and a hands-free headset. This was one of the earliest applications to become popular.
    • Wireless networking between PCs in a confined space and where little bandwidth is required.
    • Wireless communication with PC input and output devices, the most common being the mouse, keyboard and printer.
    • Transfer of files, contact details, calendar appointments, and reminders between devices with OBEX.
    • Replacement of traditional wired serial communications in test equipment, GPS receivers, medical equipment, bar code scanners, and traffic control devices.
    • For controls where infrared was traditionally used.
    • For low bandwidth applications where higher [USB] bandwidth is not required and cable-free connection desired.
    • Sending small advertisements from Bluetooth-enabled advertising hoardings to other, discoverable, Bluetooth devices[citation needed].
    • Wireless bridge between two Industrial Ethernet (e.g., PROFINET) networks.
    • Two seventh-generation game consoles, Nintendo's Wii[6] and Sony's PlayStation 3, use Bluetooth for their respective wireless controllers.
    • Dial-up internet access on personal computers or PDAs using a data-capable mobile phone as a modem. "
    some very common examples arround are Bluetooth Headsets / sensors for mobile deveices and computer mice etc.

    for further info check
    http://en.wikipedia.org/wiki/Bluetooth

    As per wikipedi
    "Bluetooth is a standard and a communications protocol primarily designed for low power consumption, with a short range (power-class-dependent: 1 meter, 10 meters, 100 meters) based on low-cost transceiver microchips in each device.[5] Bluetooth makes it possible for these devices to communicate with each other when they are in range. Because the devices use a radio (broadcast) communications system, they do not have to be in line of sight of each other.

    More prevalent applications of Bluetooth include:

    • Wireless control of and communication between a mobile phone and a hands-free headset. This was one of the earliest applications to become popular.
    • Wireless networking between PCs in a confined space and where little bandwidth is required.
    • Wireless communication with PC input and output devices, the most common being the mouse, keyboard and printer.
    • Transfer of files, contact details, calendar appointments, and reminders between devices with OBEX.
    • Replacement of traditional wired serial communications in test equipment, GPS receivers, medical equipment, bar code scanners, and traffic control devices.
    • For controls where infrared was traditionally used.
    • For low bandwidth applications where higher [USB] bandwidth is not required and cable-free connection desired.
    • Sending small advertisements from Bluetooth-enabled advertising hoardings to other, discoverable, Bluetooth devices[citation needed].
    • Wireless bridge between two Industrial Ethernet (e.g., PROFINET) networks.
    • Two seventh-generation game consoles, Nintendo's Wii[6] and Sony's PlayStation 3, use Bluetooth for their respective wireless controllers.
    • Dial-up internet access on personal computers or PDAs using a data-capable mobile phone as a modem. "
    some very common examples arround are Bluetooth Headsets / sensors for mobile deveices and computer mice etc.

    for further info check
    http://en.wikipedia.org/wiki/Bluetooth