# Call by Value

 James Moore · October 23, 2015 Hey guys ! So I'm going to post a program(with running script) and all of which work the way there supposed to but I feel like I'm using more code than I have to. The first is using Call by value and the second is using call by reference(next post). At the end of the program ill put things i notice and just want to know if there even possible to do and how. Script started on Fri Oct 23 01:52:54 2015Enter Three Fahrenheit temps to convert to Celcious68-40100Enter Three Celcious temps to Fahrenheit20-4020  1 30The Temperture Conversions from Fahrenheit to Celcious are  Fahrenheit | Celsious68.00 | 20.00 -40.00 | -40.00 100.00 | 37.78 The Temperture Conversions from Celsious to Fahrenheit are  Celsious | Fahrenheit20.00 | 68.00 -40.00 | -40.00 30.00 | 86.00 Script done on Fri Oct 23 01:53:56 2015#include #include #include #include #include // Function prototypes float convertToCelcious(float temp);float convertToFahr(float temp); void printAll(float temp, float funk); int main(){// Variable declarations for temp placeholders     float temp1,temp2,temp3;float temp4,temp5,temp6; printf("Enter Three Fahrenheit temps to convert to Celcious\n");scanf("%f %f %f",&temp1,&temp2,&temp3); printf("Enter Three Celcious temps to Fahrenheit\n"); scanf("%f %f %f",&temp4,&temp5,&temp6); // Beggining of table of print outs printf("The Temperture Conversions from Fahrenheit to Celcious are \n "); printf("Fahrenheit \t | Celsious\n"); // Call to printAll using temp and value of convertToCelcious with temp as argument printAll(temp1,convertToCelcious(temp1));printAll(temp2,convertToCelcious(temp2));printAll(temp3,convertToCelcious(temp3));printf("The Temperture Conversions from Celsious to Fahrenheit are \n "); printf("Celsious \t | Fahrenheit\n"); // Call to printall using temp and value of convertToFahr with temp as argument printAll(temp4,convertToFahr(temp4)); printAll(temp5,convertToFahr(temp5)); printAll(temp6,convertToFahr(temp6));  return 0; }// Function deffinitions // Function deffiniton for convertToCelciousfloat convertToCelcious(float temp) {    float cel = (temp - 32) / 1.8000;          return(cel); } // function deffiniton for convertToFahrfloat convertToFahr(float temp) {    float fahr = temp * 9 / 5 + 32;        return(fahr); } // Function deffiniton for printAll void printAll(float temp, float funk){    printf("%.2f \t \t | %.2f \n", temp, funk);         return; }How can i make it so i just print it all out with one call to printall function instead of a bunch. or is that not possible?

## Replies

Nothing to see here.

## C

120,638 followers