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

string to int/double instead of type casting

parent 0191b0c3
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
/* Miguel Espino | lfc083 | 11352639 */
#include <qsort.h>
#include <stdlib.h>
/* returns -1 if first < second
* returns 0 if first == second
......@@ -16,8 +17,8 @@ int compareDouble(void *first, void *second)
{
double dFirst, dSecond;
dFirst = *(double*)first;
dSecond = *(double*)second;
dFirst = strtod(first,NULL);
dSecond = strtod(second,NULL);
if(dFirst < dSecond){
return -1;
......
......@@ -19,8 +19,8 @@ int compareInt(void *first, void *second)
{
int iFirst, iSecond;
iFirst = *(int*)first;
iSecond = *(int*)second;
iFirst = atoi(first);
iSecond = atoi(second);
if(iFirst < iSecond){
return -1;
......
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