Advertisements
Advertisements
प्रश्न
Differentiate between call by value and call by reference.
अंतर स्पष्ट करें
उत्तर
S. No. | Call by value | Call by reference |
1. | Pass-by value transfers a copy of the actual parameters to the formal parameters. | Pass by reference refers to conveying the address of actual parameters to formal parameters. |
2. | Changes in formal parameters do not affect actual parameters. | Changes to formal parameters will be mirrored in actual parameters. |
3. | Call by value is typically used for primitive data types (e.g., int, char). | Use call-by-reference for non-primitive data types, such as objects and arrays. |
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 5: User - Defined Methods - EXERCISES [पृष्ठ ३३७]