#include <stdio.h>

struct point
{
  int x;
  int y;
};

typedef struct point POINT;

struct rectangle
{
	struct point top_left;
	struct point bottom_right;
};

typedef struct rectangle RECTANGLE;

int computeArea(RECTANGLE);

int main(void)
{
  struct rectangle rectangle1 = {{2, 5}, {7, 1}};
  struct point point1;
  point1.x = 3;
  point1.y = 12;
  POINT point2 = {10, 4};
  RECTANGLE rectangle2;
  rectangle2.top_left = point1;
  rectangle2.bottom_right = point2;

  int area1 = computeArea(rectangle1);
  printf("The area of rectangle1 is %d\n", area1);

  printf("The area of rectangle2 is %d\n", computeArea(rectangle2));

  return 0;
}

int computeArea(RECTANGLE r)
{
  int width = r.bottom_right.x - r.top_left.x;
  int height = r.top_left.y - r.bottom_right.y;

  return width*height;
}
