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
A document repository is down when you attempt to access it. which isa principle is being violated?
Tju [1.3M]
When a document repository is down when you attempt to access it, the ISA principle Authentication is being violated. The authentication method is done during the log on phase and is performed by the ISA server which requests certificate. <span>The client then needs to send the appropriate client certificate to the server in order to be authenticated and to have access to the document.</span>
3 0
3 years ago
What type of file format is PSD?
Ronch [10]

Answer:

PSD (Photoshop Document)

Explanation:

PSD (Photoshop Document) is an image file format native its one of Adobe's popular Photoshop Application. PSD files are commonly used for containing high quality graphics data.

8 0
2 years ago
Read 2 more answers
Hi what is full form of ugst​
AURORKA [14]

Answer:

UGST – Union Territory Goods & Services Tax.

4 0
3 years ago
Read 2 more answers
Most nosql data stores were created to address problems associated with storing large amounts of distributed data in __________.
finlep [7]
NoSQL is primarily designed for supporting the decision making systems. Most NoSQL data stores were created to address problems associated with storing large amounts of distributed data in relational database management systems(RDBMS).
RDBMS is system used for the management of the database.D<span>ata is stored in the form of related tables.</span>
3 0
3 years ago
In researching his history report about the Civil War, why is Ariq most likely to use secondary data than primary data? Secondar
shusha [124]

Hello! Your answer is....

Secondary data is easier and less time consuming to fine.


I hope this helps, you are very pretty and have an awesome day!

8 0
3 years ago
Read 2 more answers
Other questions:
  • In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sid
    10·1 answer
  • What is malware short for?
    13·2 answers
  • Web and mobile applications are created for users to only read information. True False
    15·2 answers
  • Which technology concept uses computer resources from multiple locations to solve a common problem?
    11·2 answers
  • 1. Do you agree that Facebook is the best social media platform to use for interpersonal communication? Why or why not?
    13·2 answers
  • The sequence's insert member function normally puts a new item before the current item. What should insert do if there is no cur
    9·1 answer
  • a publication usually issued daily,weekly or other regular times that provides news,views,features and other information of publ
    8·1 answer
  • What does the following Boolean operators do?<br>AND function<br>OR function<br>NOT function​
    8·1 answer
  • ```{r}
    11·1 answer
  • When computer network are joined together they form a bigger network called the​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!