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
Yuri, a medical assistant, has been asked to send an account of a patient's last office visit to another doctor's office. The te
g100num [7]
The internet,,

To let the other doctor know about specific details on the patient, and other excessive information.

Hope this helps!! :)
6 0
3 years ago
Read 2 more answers
_____ allows you to use the internet for making phone calls instead of leasing traditional telephone lines from the phone compan
TEA [102]
Using a browser would help in doing that.
3 0
2 years ago
Please Help ASAP. Marking Brainliest For Correct Answer.
mezya [45]

Answer: It is not working because it is missing the code needed to turn right.

Sentence :The robot would move forward two squares and would stay stuck there because it can not move forward nor turn left. You would need to add code for the robot to be able to turn right so that the robot can reach the goal

6 0
2 years ago
Dwight <br> d. eisenhower was impressed with germany's network of highways and how it __________.
emmasim [6.3K]
Eased the mobilization and transportation of troops
5 0
2 years ago
Inputting a range of numbers comprising a batch and then inputting each serially numbered document is characteristic of the cont
Fynjy0 [20]

Answer:

batch sequence check.

Explanation:

A batch sequence check can be defined as a strategic and systematic control plan which typically involves the process of inputting a range of numbers comprising a batch and then inputting each serially numbered document.

The steps for checking an event data within a batch using a batch sequence check include the following;

I. You'll enter a range of serial numbers of the document in a batch.

II. You'll enter each serially pre-numbered document one after the other.

III. The input documents are sorted by a computer into a serial (numerical) order, match the sequence number range against the input documents, and then reports any part of the document that is missing, a duplicate and out of range.

6 0
3 years ago
Other questions:
  • PLEASE HELP POWER POINT:
    8·2 answers
  • The code segmentif (speed &lt;= 40)cout &lt;&lt; "Too slow";if (speed &gt; 40 &amp;&amp; speed &lt;= 55)cout &lt;&lt; "Good spee
    11·1 answer
  • 1. You have recently been hired by a leading firm, which provides information management solutions to large corporations. As a n
    12·2 answers
  • What provides access to the internet and may also be internal?
    8·2 answers
  • Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host B each send a UDP segment to Ho
    8·1 answer
  • Which operating system (OS) is used to run your laptop?
    15·2 answers
  • What is a characteristic of high-level languages?
    15·1 answer
  • I’ll give brainliest if answers are correct
    11·1 answer
  • Importancia del sistema operativo
    6·1 answer
  • The rectangle shape in flowchart is used for
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!