1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ddd [48]
3 years ago
7

What is the difference between "call by value" and "call by reference"? Explain with example in c language.

Computers and Technology
1 answer:
Serjik [45]3 years ago
7 0

Answer:

<u>Call by reference</u>

In an function if the variables are passed as reference variables this means that the variables are pointing to the original arguments.So the changes made in the function on the reference variables will be reflected back on the original arguments.

For example:-

#include<stdio.h>

void swap(&int f,&int s)

{

   int t=f;

   f=s;

  s =temp;  

}

int main()

{

int n,m;

n=45;

m=85;

swap(n,m);

printf("%d %d",m,n);

return 0;  

}

the values of m and n will get swapped.  

<u> Call by value</u>

In this program the values of m and n will not get swapped because they are passed by value.So duplicate copies of m and n will be created and manipulation will be done on them.

#include<stdio.h>

void swapv(int f,int s)

{

   int t=f;  

   f=s;  

   s=temp;

}

int main()

{  

int n,m;

n=45;

m=85;

swapv(n,m);

printf("%d %d",n,m);

return 0;

}

You might be interested in
MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
aliya0001 [1]

Answer:

whyyyyy

have  a good day :)

Explanation:

7 0
3 years ago
Your college has several campuses located across the city. within each campus, the buildings are interconnected with a campus ar
iris [78.8K]

Answer:

Metropolitan Area Network (MAN)

Explanation:

8 0
1 year ago
When was the GoPro camera invented?​
masya89 [10]

Answer:

2002

Explanation:

Please mark me brainliest :)

6 0
3 years ago
David Rosen is credited with the development of which of these games?
nikklg [1K]
David Rosen is the CEO and lead programmer of Wolfire games. some of their games include Overgrowth, Desperate Gods, and Receiver.
4 0
3 years ago
A client sends seven equal sized segments with sequence numbers 15, 25, 35,45, 55, 65, and 75. Segments with sequence numbers 35
ikadub [295]

Answer: I believe the answer is 6

Explanation: taking 35 and 65 out leaves the rest of the numbers; 15,25,45,55, and 75.

3 0
3 years ago
Other questions:
  • Microsoft word's spell checker
    7·2 answers
  • What is the purpose of application software policies?
    12·1 answer
  • An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
    14·1 answer
  • The World Wide Web is full of unstructured data. Search engines like Google, Bing and Yahoo have been doing a good job of allowi
    6·1 answer
  • Malwar is the short form for malicious software and used to refer​
    14·1 answer
  • As technology advances, does technology become more of less complex?
    14·1 answer
  • Match the job roles with their appropriate qualifications. business analyst multimedia artist network and computer systems admin
    9·2 answers
  • Looking for friends, anyone up for it?
    12·2 answers
  • Sally has 4 quarters, 2 dimes, 6 nickels, and 10 pennies.
    13·2 answers
  • Ncomputing and thin client<br>what it is <br>why is done , how it works and how it's <br> done ​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!