Skip to content

Commit a6f6d9e

Browse files
committed
adding variables to cmp_points in graham.c
1 parent 61bde39 commit a6f6d9e

File tree

1 file changed

+5
-2
lines changed
  • chapters/computational_geometry/gift_wrapping/graham_scan/code/c

1 file changed

+5
-2
lines changed

chapters/computational_geometry/gift_wrapping/graham_scan/code/c/graham.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ struct point {
1010
};
1111

1212
int cmp_points(const void *a, const void *b) {
13-
if (((struct point*)a)->y > ((struct point*)b)->y) {
13+
struct point* pa = (struct point*) a;
14+
struct point* pb = (struct point*) b;
15+
16+
if (pa->y > pb->y) {
1417
return 1;
15-
} else if (((struct point*)a)->y < ((struct point*)b)->y) {
18+
} else if (pa->y < pb->y) {
1619
return -1;
1720
} else {
1821
return 0;

0 commit comments

Comments
 (0)