English

Explain call by value with an example. - Structured Programming Approach

Advertisements
Advertisements

Questions

Explain call by value with an example.

Explain call by value with a suitable example.

Explain
Advertisements

Solution

  1. 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.
  2. Inside the function, these copied values may be modified or changed.
  3. 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.
  4. For example:
    main ()
    { void funct (int X, int Y);
            ........
    funct (X, Y); // Call by value
    ........
    }
    void funct (int a, int b)
    { ........
    }
shaalaa.com
Domain and Range of a Function - Passing Arguments to a Function
  Is there an error in this question or solution?
2018-2019 (December) CBCGS
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×