write a program that using call by reference sends a float t

write a program that using call by reference sends a float to a function. the function calculates the inverse.

Solution

#include \"stdio.h\"
void inverse(float*);
int main(void) {
   float f=1.5;
printf(\"%f\ \",f);
inverse(&f);       // pass address, call by reference.
printf(\"%f\ \",f);
return 0;
}
void inverse(float* f){
   *f = 1.0/(*f);       // calculate inverse.
}

/*

sample output

*/

write a program that using call by reference sends a float to a function. the function calculates the inverse.Solution#include \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site