IEO Level 2- English Olympiad (SOF) Class 9 Coaching Programs
β³ π― Online Tests (2 Tests [50 Questions Each]): NTA Pattern, Analytics & Explanations
Click Here to View & Get Complete Material
Rs. 200.00
3 Year Validity (Multiple Devices)
π Study Material (303 Notes): 2024-2025 Syllabus
Click Here to View & Get Complete Material
Rs. 450.00
3 Year Validity (Multiple Devices)
π― 250 MCQs (& PYQs) with Full Explanations (2024-2025 Exam)
Click Here to View & Get Complete Material
Rs. 200.00
3 Year Validity (Multiple Devices)
Computer Science: Function: Call by Value: Calling of Function
Call by Value
Calling of Function
The function can be called using either of the following methods:
Consider the following program which will swap the value of two variables using the method call-by-value.
# include < iostream. h >
void swap (int, int) .
void main ()
{
int a, b.
cin >> a >> b.
swap (a, b) .
cout << a << b << β⧡nβ .
}
void swap (int c, int d)
{
int t.
t = c.
c = d.
d = t.
cout << c << d << β {} nβ .
}
- The variables a and b are called actual parameters.
- When calling the function swap () . the value of a is passed onto c and value of b is passed onto d.
- Here c and d are called formal parameters.
In the function swap () , the value are swapped but this change will not be implemented to actual parameters.
Input 5 6
Input 65
56