From ce67f705bd67f6366c4627f5db9de77337b05360 Mon Sep 17 00:00:00 2001
From: Miguel Espino <lfc083@usask.ca>
Date: Fri, 22 Nov 2024 15:49:58 -0600
Subject: [PATCH] double comp syntax fixes and implemented intComp

---
 doubleComp.c |  4 ++--
 intComp.c    | 10 +++++++++-
 swap.c       |  2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/doubleComp.c b/doubleComp.c
index ce6e054..64c4fcf 100644
--- a/doubleComp.c
+++ b/doubleComp.c
@@ -17,10 +17,10 @@ int compareDouble(void *first, void *second)
   dFirst = *(double*)first;
   dSecond = *(double*)second;
 
-  if(first < second){
+  if(dFirst < dSecond){
     return -1;
   }
-  return (first > second);
+  return (dFirst > dSecond);
     /* fill in the details of comparing 2 doubles */
 }
 
diff --git a/intComp.c b/intComp.c
index d37c325..db7f134 100644
--- a/intComp.c
+++ b/intComp.c
@@ -12,11 +12,19 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-
+#include <qsort.h>
 
 int compareInt(void *first, void *second)
 {
+ int iFirst, iSecond;
+
+ iFirst = *(int*)first;
+ iSecond = *(int*)second;
 
+ if(iFirst < iSecond){
+  return -1;
+ }
+ return (iFirst > iSecond);
  /* fill in details of comparing 2 integers */
  /* look at complexComp.c for the idea behind this solution */
   
diff --git a/swap.c b/swap.c
index a8a1cc1..94fc42a 100644
--- a/swap.c
+++ b/swap.c
@@ -4,6 +4,8 @@
  * @date: July 2023
  */
 
+#include <qsort.h> 
+
 void swap(void  *v[], int i, int j)
 {
   void *temp;
-- 
GitLab