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 of the following is something you need to keep an eye out for
Brilliant_brown [7]

Answer:

D. Pedestrians ignoring DON'T WALK signs

Explanation:

Pedestrians ignoring DON'T WALK signs is something you need to keep an eye out for  near packed intersections.

4 0
3 years ago
Read 2 more answers
Which of the following is not a negative environmental effect associated with cars? A. Deforestation B. Roadside litter C. Toxic
777dan777 [17]

Answer:

The answer to this question is the option "C".

Explanation:

In this question, the answer is option C. Which is river toxic pollution. This pollution is also known as Kim Kim river toxic pollution. In 2019 this pollution occurred in the water caused by unauthorized chemical garbage dumping in the river in Malaysia. The unauthorized dumping released poisonous fumes, affecting six thousand people are hospitalized in 2,775.

8 0
3 years ago
Beside homework, what products can you use for personal use? Identify three uses and briefly describe.
Dominik [7]
<span>Beside homework, what products can you use for personal use? Identify three uses and briefly describe.

</span>
3 0
3 years ago
Read 2 more answers
Help plzzzzzzzzzzzzzzzzzzzzzzzzz
Reil [10]

B, Parallel ports are faster than serial ports.

A parallel port can move a set of 8 bits at a time on eight different wires, it uses a 25 pin connector, called a DB-25 connector, whereas a serial port only has a DB-9 connector.

7 0
2 years ago
Which of the following is NOT a common grammar adjustment which is identified by grammar-check software?
Sedbober [7]

Answer:

Shortened versions of phrases Ex:(l ol, s mh, i dk, ect.)

Explanation:

Hope that this helps, if you have any more question please feel free to contact me, hope you have an amazing rest of your day. ;D

7 0
2 years ago
Other questions:
  • Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by a space a
    10·1 answer
  • Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho
    9·1 answer
  • You are the IT administrator for a small corporate network. You have installed the Windows Server 2016 operating system on a ser
    12·1 answer
  • Find two consecutive even integers such that twice the smaller is 16 more than the larger
    10·1 answer
  • One form of online vandalism is ____ operations, which interfere with or disrupt systems to protest the operations, policies, or
    9·2 answers
  • A software development company wants to reorganize its office so that managers and the Computer Programmers they supervise can b
    13·2 answers
  • Spam and i report
    14·2 answers
  • How do you answer a question that's already been answered?
    5·1 answer
  • "Bookings are to be stored in three separate
    7·1 answer
  • How to write my name in binary code ? Rivas
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!