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
Dvinal [7]
4 years ago
13

What is value parameter and reference parameter while things are passed by Also, do a c code to show it

Computers and Technology
1 answer:
azamat4 years ago
3 0

Answer: While constructing a function the parameters can be passed by value or by reference.

In value parameter we actual make a copy of the values which has been passed to the function from the main method while we reference parameter we copy the address of the values in memory so that while our program references those values it it can refer them from their memory location.

Explanation:

Now we take can example to show parameter passing by value and reference with the help of an C program to add two numbers

int add_val(int x, int y) {

 return x + y;

}

void add_ref(int *x, int y) {

 *x += y;

}

int main () {

 int a, b, c, d;

 a = 2;

 b = 1;

 c = add_val(a,b); //value parameter

 d = add_ref(&a, c); // reference parameter

 return 0;

}

In the above code the value the value of c is 3 and the value of d is 5. In add_p we have passed the address of the a but in add_val we have passed the values of a and b.

You might be interested in
Which of the following is a type of savings vehicle? A.Certificate of Deposit
Ksivusya [100]
<span>A is the correct answer. A Certificate of Deposit is a savings vehicle that offers a particular, fixed date of maturity for someone, with high interest rates as a result of this fixed term - they cannot remove the money early without incurring a loss of potential earnings.</span>
3 0
3 years ago
What is the difference between special purpose software and customized software​
Leviafan [203]
The choice of a specific software product model depends on your business specs. General-purpose solutions cover a set of the most common functions. The tailor-made one allows you to stand out for the individual approach for business processes and tasks.Jul 27, 2020
8 0
3 years ago
Read 2 more answers
When describing a software lincense, what does the phrase "open source" mean?
NikAS [45]

Answer:

The phrase "Open Source" means that a program's source code is freely available and may be modified and redistributed.

Explanation:

Hope this helped :)

8 0
3 years ago
In what four ways do we commonly respond?
Gnoma [55]

Answer:

A

Explanation:

4 0
3 years ago
HELP ME PLZ QUICK Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took
topjm [15]

Adam might have forgotten to loop the guessing code, meaning that instead of letting him guess multiple times, it simply does it once and ends the program. This could be fixed by adding a while loop, or something of the sort, that doesn't let the user finish the program until they guess the number correctly, while adding to the variable that stores the number of guesses each loop.

8 0
4 years ago
Other questions:
  • Which choice lists two image formats that support transparency
    6·2 answers
  • A(n) ____________ specifies a variable's name and data type.
    5·2 answers
  • How do you add a section break that would start the new section on the same page?
    12·2 answers
  • To add text to a slide when using presentation software, you need to add a text box. To add a text box, click the Text Box butto
    8·2 answers
  • Which is a good guideline to follow when looking for research material on the Internet?
    10·2 answers
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    12·2 answers
  • output device is any peripheral to provide data and control signal to ab information processing system​
    7·1 answer
  • Uuhdcnkhbbbbhbnbbbbnnnnnnnnnfddjkjfs
    14·1 answer
  • C. There are two types of computer on the basis of size. true or false​
    5·1 answer
  • Any computer expert to help me answer this question plz am giving brainliest
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!