this program prints out -8 -4 but i wanna know why and why isn't the compiler showing an error about which function to use? why are the results different. i don't know much about defining a function like this can someone explain this too
#include <stdio.h>
#include <stdlib.h>
int foo(int x, int y);
#define foo(x, y) x/y + x
int main() {
int i = -6, j = 3;
printf("%d ", foo(i + j, 3));
#undef foo
printf("%d\n", foo(i + j, 3));
}
int foo(int x, int y) {
return x/y + x;
}