Skip to content
Snippets Groups Projects
Commit ce67f705 authored by Miguel Espino's avatar Miguel Espino
Browse files

double comp syntax fixes and implemented intComp

parent 28f52659
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
}
......
......@@ -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 */
......
......@@ -4,6 +4,8 @@
* @date: July 2023
*/
#include <qsort.h>
void swap(void *v[], int i, int j)
{
void *temp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment