• Join us

Questions on User Defined Function

To add comments, please log in or register
chua le
383
chua le  

Hi,


I have the following questions on user defined function:


Question 1. Can I put a if statement within the function as I want to combine two functions into one ?

Question 2. Can I use the same variable (a and b) in two different functions, does it confuse the program . In the main program we have to use different variables.


Regards

Question 1

int Function1  (int a, int b)
{
if (a==x1 && b==y1)  c=3;
if (a= x2 && b=y2  )  c=4;
return (c);
}




Question 2

int Function2  (int a)
{
b=2
return (b);
}

int Function3 (int a)
{
b=3
return (b);
}

To add comments, please log in or register