Functions with Call by Value parameters and/or Return Values

Now consider the following :

// file : square1.C
#include <iostream.h>

void square(float);

int main()
{
  float x;

  x=5.5;
  square(x);

  return 0;
}

void square(float a)
{
  float b;

  b = a * a;
  cout << "The squared value is " << b << endl;
}

And consider this one :

// file : square2.C
#include <iostream.h>

float square(void);

int main()
{
  float y;

  y=square();
  cout << "The squared value is " << y << endl;
  
  return 0;
}

float square()
{
  float a;
  float b;

  a=5.5;
  b = a * a;
  return b;
}



And finally, this one :

// file : square3.C
#include <iostream.h>

float square(float);

int main()
{
  float x,y;

  x=5.5;
  y=square(x);
  cout << "The squared value is " << y << endl;

  return 0;
}

float square(float a)
{
  float b;

  b = a * a;
  return b;
}

Same here - if you don't understand these examples, then ask...