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
pav-90 [236]
3 years ago
12

Write the half function. A function call and the functionprototype

Computers and Technology
1 answer:
EastWind [94]3 years ago
3 0

Answer:

C code for half()

#include<stdio.h>

void half(float *pv);

int main()

{

float value=5.0;  //value is initialized  

printf ("Value before half: %4.1f\n", value); // Prints 5.0

half(&value);  // the function call takes the address of the variable.

printf("Value after half: %4.1f\n", value); // Prints 2.5

}

void half(float *pv) //In function definition pointer pv will hold the address of variable passed.

{

*pv=*pv/2;  //pointer value is accessed through * operator.

}

  • This method is called call-by-reference method.
  • Here when we call a function, we pass the address of the variable instead of passing the value of the variable.
  • The address of “value” is passed from the “half” function within main(), then in called “half” function we store the address in float pointer ‘pv.’ Now inside the half(),  we can manipulate the value pointed by pointer ‘pv’. That will reflect in the main().
  • Inside half() we write *pv=*pv/2, which means the value of variable pointed by ‘pv’ will be the half of its value, so after returning from half function value of variable “value” inside main will be 2.5.

Output:

Output is given as image.

You might be interested in
1.
Alecsey [184]
I think
The start and end shape
7 0
3 years ago
Explain the concept of conditional formatting​
tamaranim1 [39]

Answer:

conditional formatting is a feature in many spreadsheet application that allow you to apply specific formatting to cells that meet certain criteria.It is most often used on color based formatting to highlight emphasize or differentiate among data and information stored in spreadsheet

8 0
3 years ago
What two variables does mass depend on?
Ber [7]

Answer:       The answer to your question would be A

have a good day

Explanation:

4 0
3 years ago
3.2 lesson practice edhesive ​
Nookie1986 [14]
Ummm what is the question
6 0
3 years ago
A call center is a _______.<br><br> JIT<br><br> CMA<br><br> CIC<br><br> SFA
sp2606 [1]

Answer: CIC

Explanation:

A call center is a customer interaction center (CIC) and it is the interface between call center agent with the customers directly. CIC are connected by the external telephone system and it uses as call center.

And the caller are basically identify by the telephone number and customer information are display in the CIC.

CIC are the modular structure for communication which include various components of CIC and framework.

4 0
3 years ago
Other questions:
  • Which type of security personnel may work for government as well as for private security agencies?
    7·2 answers
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • A light or optical microscope most commonly used is called a(n) _____. bright-field microscope dark-field microscope electron mi
    8·2 answers
  • In a ring-based system, procedure p is executing and needs to invoke procedure q. Procedure q's access bracket is (5,6,9). In wh
    15·2 answers
  • A 10-foot ladder must make an angle of 30° with the ground if it is to reach a certain window. What angle must a 20-foot ladder
    9·2 answers
  • Swiping up with three fingers on mac os x launches what?
    8·1 answer
  • _______ tools enable people to connect and exchange ideas.
    7·2 answers
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • Choose the correct answer
    6·1 answer
  • Which of the following lines of code would reduce the player’s gold by 100 coins?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!