/****
 *
 * A simple C program that defines a rectangle data structure and two functions
 * that operate on rectangles.
 *
 */

#include <stdio.h>

struct Rectangle {
    int x;
    int y;
    int width;
    int height;
};

    struct Rectangle move(struct Rectangle r, int x_increment, int y_increment) {
        r.x = r.x + x_increment;
        r.y = r.y + y_increment;
        return r;
    }

    unsigned char equals(struct Rectangle r1, struct Rectangle r2) {
        return r1.x == r2.x &&
               r1.y == r2.y &&
               r1.width == r2.width &&
               r1.height == r2.height;
    }

    int main() {
        struct Rectangle r1 = {10, 20, 100, 200};
        struct Rectangle r2 = {20, 30, 100, 200};
        unsigned char eq;

        eq = equals(r1, r2);
        if (eq == 0) {
            printf("r1 not = r2\n");
        }
        else {
            printf("r1 = r2\n");
        }

        r1 = move(r1, 10, 10);
        eq = equals(r1, r2);
        if (eq == 0) {
            printf("r1 not = r2\n");
        }
        else {
            printf("r1 = r2\n");
        }

    }