Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.3k views
in Functions by (32.9k points)
closed by

Explain ‘Call by Value’ and ‘Call by Reference’ methods of function calling with the help of a suitable example.

1 Answer

+1 vote
by (30.8k points)
selected by
 
Best answer

Two types are call by value and call by reference. 

1. Call by value: 

In call by value method the copy of the original value is passed to the function, if the function makes any change will not affect the original value. 

Example

#include<iostream>

using namespace std;

void swap (int x, int y)

{

}

There is no changes in the values.

2. Call by reference: 

In call by reference method the address of the original value is passed to the function, if the function makes any change will affect the original value. 

Example

#include<iostream>

using namespace std;

void swap (int x, int y)

{

}

There is a changes in the values.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...