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
Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?
NeTakaya

Answer: Most obvious spam messages will still reach the client computer

Explanation:

It should be noted that by default, usually the junk email filter is already set to No Automatic Filtering.

When a user configures No Automatic Filtering in Junk Mail Options, it should be noted that most obvious spam messages will still reach the client computer.

Therefore, the correct option is D.

5 0
3 years ago
Why did scientists who study weather need more advanced technology? Check all that apply.
kobusy [5.1K]

Answer:

All options are correct.

Explanation:

All options apply to the question because they all need technology for development and improvement. Scientists needed to develop more technologies in order to attend all their necessities, such as anticipating weather changes, forecasting weather previously, predicting weather behaviour in different places and in one specific place, accounting for reasons and natural resources related to weather changes, and much more. Therefore, technology provides faster and more consistent data for all these informations needed, since all technology tools to study weather were developed according to their specific needs.

4 0
3 years ago
Read 2 more answers
During the course of execution of a program, the processor will increment the contents of the instruction register (program coun
Oksana_A [137]
Bdbdbdhdhdhdhdjdbsbbrvrvrrvrvrvfvfvvfvfvfvfvfhdhdhdhdhdhdhhdududududududuebebbedvdvd I known why ahh it happened
8 0
2 years ago
Jim has entered the age of each of his classmates in cells A1 through A65 of a spreadsheet.
alexandr402 [8]
The answer to this is B=MODE(A1:A65)
8 0
3 years ago
When considering changing the content of a cell which button should you press to leave the cell as it originally was?
densk [106]
Esc key or cancel .........
7 0
3 years ago
Read 2 more answers
Other questions:
  • What is a nonlinear presentation
    9·2 answers
  • Which field can be used to track the progress on tasks that a user has created?
    10·1 answer
  • Which of the following is not part of active listening?
    6·2 answers
  • Help please fast
    6·2 answers
  • Which is true about POP3 and IMAP for incoming email?
    10·1 answer
  • Write C++ code to open a document with the name Hello.txt, place the message "Hello, World!" in the document, and exit the docum
    8·1 answer
  • The Internet began when a large company wanted to sell products online.
    11·2 answers
  • To be useful for most household applications, DC voltage is?please <br>​
    7·1 answer
  • Who's hype for Halo Infinite?
    11·2 answers
  • 3 ᴍᴜʟᴛɪᴘʟᴇ-ᴄʜᴏɪᴄᴇ Qᴜᴇꜱᴛɪᴏɴꜱ
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!