Advertisements
Advertisements
प्रश्न
Explain call by value with an example.
Explain call by value with a suitable example.
स्पष्ट करा
Advertisements
उत्तर
- When a function is called by a part of the program, control is passed from the main program to the called function, and the values of actual arguments are copied into the function.
- Inside the function, these copied values may be modified or changed.
- When control returns from the function to the calling program, the modified values are not reflected back in the original arguments. This method of passing arguments is known as call by value.
- For example:
main () { void funct (int X, int Y); ........ funct (X, Y); // Call by value ........ } void funct (int a, int b) { ........ }
shaalaa.com
Functions - Passing Arguments to a Function
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2018-2019 (December) CBCGS
