好的,这是一份 C 语言代码,用于计算两个矩形的面积交。
#include <stdio.h>
struct Rectangle {
int x1, y1, x2, y2;
};
int max(int a, int b) {
return a > b ? a : b;
}
int min(int a, int b) {
return a < b ? a : b;
}
int overlap(struct Rectangle a, struct Rectangle b) {
int x_overlap = max(0, min(a.x2, b.