29 lines
587 B
C
29 lines
587 B
C
|
#include <stdlib.h>
|
||
|
|
||
|
#include "advent_utility.h"
|
||
|
|
||
|
struct Point new_Point(int x, int y) {
|
||
|
struct Point p;
|
||
|
p.x = x;
|
||
|
p.y = y;
|
||
|
return p;
|
||
|
}
|
||
|
|
||
|
struct Point *new_Point_p(int x, int y) {
|
||
|
struct Point *p = malloc(sizeof(struct Point));
|
||
|
p->x = x;
|
||
|
p->y = y;
|
||
|
return p;
|
||
|
}
|
||
|
|
||
|
int same_Point(const struct Point* a, const struct Point* b) {
|
||
|
if (a->x == b->x && a->y == b->y) {
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int same_Point_v(const void *a, const void *b) {
|
||
|
return same_Point((const struct Point *)a, (const struct Point *)b);
|
||
|
}
|