I noticed a few more errors in your functions.
Code:
int square2 (p2_y);
{
return p2_y * p2_y
}
If you want it to take a variable you pass, you need to declare the type of variable. Also, you shouldn't have a semicolon on the end of the declaration but should on the return statement. p2_y is a global variable, so it's not wise to also use it as a local variable (I don't think it will cause a compile error, but it is confusing to read).
If you want separate functions for each joystick axis, you could write it like:
Code:
int square2 ()
{
return (p2_y * p2_y);
}
For a generic function, you could write
Code:
int square2 (int variable_to_square)
{
return (variable_to_square * variable_to_square);
}
Note: It's much easier to help if you tell us what the error message is and what code is causing it.