I suggest activating the compiler flags for warnings. With gcc this would be -Wall and -Wconversion for example.
An error message like the following should definitely be displayed:
error C2664: "int printf(const char *const ,...)"
Thats because
printf(ans,"\n");
Is definitely not functional.
As already written, the macro for max () is wrong.
The loop works, but it probably doesn't make much sense:
for (int i = x; i < y; i++) {
int temp = max((i - 1) + min(x - 1, i - x), (n - i - 1) + min(n - y, y - i - 1));
ans = min(ans, temp);
}