Fixed char_from_long function

pull/74/head
parent 3b8e78386e
commit 3142f324c2

@ -286,14 +286,9 @@ char *yon_char_from_double(double int_to_convert)
char *yon_char_from_long(long int_to_convert) char *yon_char_from_long(long int_to_convert)
{ {
int i = 1; size_t size = 20 * sizeof(char) + 1;
double convert_check = (double)int_to_convert; char *ch = malloc(size);
for (i = 1; convert_check >= 10; i++) memset(ch,0,size);
{
convert_check = convert_check / 10;
}
char *ch = malloc(i * sizeof(char) + 1);
memset(ch,0,i * sizeof(char) + 1);
sprintf(ch, "%ld", int_to_convert); sprintf(ch, "%ld", int_to_convert);
return ch; return ch;
} }

Loading…
Cancel
Save