Thread: passing to a function y should be 4 but its zero

1. passing to a function y should be 4 but its zero

here is a simplfied verstion of the function i am passing x and y to but it doesnt work y should equate to 4 when passed to the function but for some reason its zero.

Code:
```#include <stdio.h>
#include <stdlib.h>

int func(int x, int y);

int main()
{
int coordinate_x=2, coordinate_y=6;
int multiply_x = 1, multiply_y = -1;

if (func(coordinate_x + (2 * multiply_x), coordinate_y + (2 * multiply_y) == 0)) //check in case more than one jump
{
printf("func worked\n");
}

return 0;
}

int func(int x, int y)
{
printf("x = %d and y = %d\n", x, y);
if (x ==4 && y ==4)
{
printf("this bit worked\n");
return 0;
}
else
{
printf("it didnt\n");
return -1;
}
}```
i been staring at this for 2 hours and i cant see what is wrong. the same method works 20 times in other places.

many thanks
coop

Code:
```if ( func(coordinate_x + (2 * multiply_x),
coordinate_y + (2 * multiply_y) == 0) )```
Notice the second argument is cordinate_y + (2 * multiply_y) == 0.
It should be:
Code:
```if ( func(coordinate_x + (2 * multiply_x),
coordinate_y + (2 * multiply_y)) == 0)```

3. If your text editor or IDE has a "highlight matching parenthesis" feature, it's a really useful tool for wrangling nested parentheses like this.