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
Select the correct answers
Mashutka [201]

Answer:

Use a mixture of External and Internal Links....

Explanation:

8 0
3 years ago
The Transmission Control Protocol (TCP) splits each message into multiple packets. It's possible for packets from the same messa
BARSIC [14]

Answer:

The header file

Explanation:

The 'header' of a packet contains two important information about the data being sent over a network,  number indicating the ordering of all the packets (This ensures that the packets are re-ordered corrected upon arrival at the destination). and information about the total number of packets that the data has been split into, this helps at the destination to know if all packets has arrived, or delayed or lost

5 0
3 years ago
How long does it take to wire a house?
Licemer1 [7]

Answer:

the rewiring of an entire home may take up to a week. Smaller jobs, like wiring a single room, may take one to two days

Explanation:

4 0
3 years ago
Read 2 more answers
True or false
atroni [7]

Answer:

for no.2 true and for Ctrl-Z False

Explanation:

Ctrl-z is and "undo" shortcut

not really sure about no.1 though, sorry :(

5 0
3 years ago
What are the modes of operation of WLANs?
Nimfa-mama [501]

Answer:

WLAN's or Wireless LAN Units have 2 main modes of operation

Explanation:

The Two Main modes of Operation are the following

<u>Infrastructure Mode:</u> in this mode the main WLAN unit becomes the main connection point in which all devices are connected to and the main unit provides an internet connection to all the devices connected to it.

<u>Ad Hoc Mode:</u> in this mode devices transfer data from one another back and forth without permission from a base unit.

Some WLAN units will also include 2 extra modes of operation called Bridge and Wireless Distribution System (WDS).

<u>Bridge Mode:</u> this mode allows the base unit to act as an intermediary and bridge two different connection points. Such as bridging a wired connection with a wireless one.

<u>WDS Mode:</u> this mode uses various access points to wirelessly interconnect devices to the internet using repeaters to transmit connections. It can provide internet to both wired and wireless clients.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
4 years ago
Other questions:
  • What shooting position is commonly used when hunting with a shotgun?
    14·2 answers
  • Explain the nature of documents that can be suitable for mergin
    12·1 answer
  • The network topology in which each device is connected directly to a central network switch
    9·1 answer
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • If your problem is caused by a bad hardware or software installation and you get an error message the first time you restart the
    6·1 answer
  • A software process describes the interrelationship among the phases by expressing their order and frequency, but does not define
    14·1 answer
  • Write a program that uses an initializer list to store the following set of numbers in an array named nums. Then, print the arra
    10·2 answers
  • You want a cable that could be used as a bus segment for your office network. The cable should also be able to support up to 100
    5·1 answer
  • Because travel distance, cost of living, and other factors vary among the three regions, the annual cost of having a salesperson
    14·1 answer
  • Which of the following are the most important reasons people in the 1920s were so interested in seeing lifelike stories in audio
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!