| 1. |
List Out Differences Between Pass By Reference And Pass By Value? |
|
Answer» Pass by VALUE always invokes / calls the function or returns a value that is BASED on the value. This value is passed as a CONSTANT or a variable with value. Pass by reference always invokes / calls the function by passing the address or a pointer to a MEMORY location which contains the value. The memory location / pointer is populated with a value, so the function COULD look at the value through that location. The function can update the value available in the memory location by referencing the pointer. A string in C language is passed by reference. Pass by value always invokes / calls the function or returns a value that is based on the value. This value is passed as a constant or a variable with value. Pass by reference always invokes / calls the function by passing the address or a pointer to a memory location which contains the value. The memory location / pointer is populated with a value, so the function could look at the value through that location. The function can update the value available in the memory location by referencing the pointer. A string in C language is passed by reference. |
|