My own functions
Posted: Mon Nov 26, 2007 2:20 pm
Can I make my own function? If I can, how can I make them?
void()//If you need any params to entered, declare the vars in the "()"
{
//Code here
}
//Void should be used if you don't need the function to return something.
//But if you need the function to return something, use like char, double, float or int and use the "return 10.1;" or for a char "return 'a';"
type function_name(parameters)
{
body of function
};
int check_answer(int answer)
{
if (answer == 5)
{
return 1;
}
else {return 0;}
};
mark = mark + check_answer(Five);