Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
int f(); //prototype (or prototype and definition
// must be before call
int main()//main function
{
f(); //call to f
return main(); //infinte recurssion -- don't do this!
//without a conditional return
}
int f() //definition of function f
{
//do something useful
return 5;
}
#include <iostream> //First any includes
using namespace std; //namespaces if used
//prototypes
float sqr(float);
float callF(float);
int main()
{
float x = 9.8;
cout << sqr(3.5) <<endl; //prints the return
//value of sqr(3.5)
cout << callF(3) <<endl; //prints 3 after making the
//function call
float z = sqr(x); //x isn't changed...
return 0;
}
void F() //Note, no prototype,
//but it's leagal because it hasn't been called.
{
cout << "Hi" <<endl;
}
float sqr(float f) //prototyped abaove
{
return f * f;
}
float callF(float f) //prototyped above
{
F();
return f;
}
float sqr(float);