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
Maurinko [17]
3 years ago
7

Taking a suitable example in c language explain the of call by value and call by reference concepts.

Computers and Technology
1 answer:
Degger [83]3 years ago
8 0

Answer: The difference between call by value and call by reference is that in call by value the actual parameters are passed into the function as arguments whereas in call by reference the address of the variables are sent as parameters.

Explanation:

Some examples are:

call by value

#include <stdio.h>  

void swap(int, int);

int main()

{  int a = 10, b= 20;

 swap(a, b);

 printf("a: %d, b: %d\n", a, b);

}  

void swap(int c, int d)

{

 int t;

 t = c; c = d; d = t;

}  

OUTPUT

a: 10, b: 20

The value of a and b remain unchanged as the values are local

//call by reference

#include <stdio.h>

 void swap(int*, int*);

 int main()

{

 int a = 10, b = 20;

 swap(&a, &b);   //passing the address

 printf("a: %d, b: %d\n", a, b);

}

void swap(int *c, int *d)

{

 int t;

 t = *c; *c = *d; *d = t;

}

OUTPUT

a: 20, b: 10

due to dereferencing by the pointer the value  can be changed which is call by reference

You might be interested in
Jacob is a teacher and wants to sort his grades based on Test 1 and then on Test 2.
Pachacha [2.7K]
<span>He would click on the Test 1 column and press Sort, then click on the Test 2 column and press Sort. 
 It depends on what you learn because it says "shift"</span>
4 0
3 years ago
Read 2 more answers
Ex1. Classify the following statements as business (B), functional (F), non- functional (N), or data (D) requirements; for the l
Alina [70]

Answer:

<em>Solution</em>:

The statements are listed below.  

<em>(A) Functional requirement </em>

  • Functional specifications refer to the handling of calls.  
  • Minimum call number should be 3000, and a functional requirement.  

<em>(B) Non-functional requirement</em>

  • Non-functional requirement is the default option.  
  • Payment in "Visa" is required and this is not a functional requirement.

<em>(C) Data requirements</em>

  • Data requirements apply to quantity of order.  
  • When the quantity of data exceeds then an exception should be notified  

<em>(D) Business requirements. </em>

  • Product reviews are subject to business requirements.

3 0
3 years ago
Tim is in charge of the upcoming interschool baketball tournamnent. He wants to arrange all of the teams and their members in al
zalisa [80]
I think the answer is C.
7 0
3 years ago
A software-based _________ is dedicated to examining and blocking internet traffic.
igomit [66]

A software-based <u>Firewall</u> is dedicated to examining and blocking internet traffic.

7 0
3 years ago
Read 2 more answers
People are still buying printed magazines?
BARSIC [14]
Yes, they are. 
Mostly dentists' offices, though.  
3 0
3 years ago
Other questions:
  • Each organization that provides host services on the public Internet is responsible for providing and maintaining DNS authoritat
    7·1 answer
  • At the coffee shop where they work, Jen is the safety officer, Richard is in charge of administering first aid, Ashley is respon
    13·2 answers
  • Given this method comment, fill in the blank in the method implementation. /* Deposits money into the bank account amount: the a
    6·1 answer
  • "As a ____ database management system, Access is particularly powerful because you can enter data once and then retrieve informa
    6·1 answer
  • Throughout the course we have covered a lot of topics in relation to information systems. Select one or two of the major topics
    14·1 answer
  • Why would you set up a workbook to be shared if you are the only one using the workbook?
    7·1 answer
  • I made a mistake. I'm building my first PC and I bought a Ryzen 7 3800x and planning on getting a 2070 super (if I can). What I
    9·1 answer
  • Identify the parts of it, Give at least three web browser that you usually used to visit a website.​
    10·1 answer
  • Functions are used to _________
    10·1 answer
  • Bunco is a dice throwing game that requires no decisions to be made or skill on the part of the player just luck. In the simples
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!