Answers for "Passed by value-result is aliases, result will be same with pass by reference"

C
0

Passed by value-result is aliases, result will be same with pass by reference

Person p, q;
  p = new Person();
  q = p;
  // now p.name and q.name are aliases (they both refer to the same location)
  // however, p and q are not aliases (they refer to different locations)

pictorially:

                   +--------------------------------+
                   |                                |
                   |       +---------------------+  |
                   |       |                     |  |
                   |       |                     v  v
           ---     |       |                    +---+
        p: |-|-----+       |              name: |   |  a Person object
           ---             |                    |---|
                           |               age: |   |
           ---             |                    +---+
        q: |-|-------------+
           ---
Posted by: Guest on April-27-2021

Code answers related to "Passed by value-result is aliases, result will be same with pass by reference"

Code answers related to "C"

Browse Popular Code Answers by Language