Say we have a simple function named sqr(). It''s purpose is to calculate the square of a value.
We want to use the function in this way:
float f = 2.0f;float squareOfF = sqr(f);
To do this, the function sqr() has to *return* the square of f. Like this:
float sqr(float num){ return num * num; // num * num = sqr(num) = square of num}
This could also be written like this:
float sqr(float num){ float result = num * num; return result;}
I hope this has made it a little clearer for you.
My Wonderful Web Site (C++ SDL OpenGL Game Programming)
I am a signature virus. Please add me to your signature so that I may multiply.