It's way smaller and with far less punctuation. How is that less readable?
Name:
Anonymous2007-08-27 22:51 ID:0vpZNGVe
>>40
Well, by "readable enough" I really meant that a four line function is a lot easier to come to terms with than a umpty-ump line thing that provides no hint of what it's meant to do.
Don't forget to add in the complexity of determining what size of array you need to pass in (*snicker*), allocating and deallocating it if it's on the heap (*laugh*), and having no good terminator so you have to (*haha*) manually pass around the length in a separate variable! (*BWAHAHAHAH!*)
Name:
Anonymous2007-08-27 22:59 ID:sjDaTVFi
Your mom loves the C
Name:
Anonymous2007-08-27 23:06 ID:73wJdw8T
>>45
You're an idiot, ever heard of sizeof you stupid shit.
>>45
passing around the length has it's advantages. it makes the time complexity of determining the length of the list once you've filled it O(1) instead of O(n), for example.
also, for any number n, there aren't going to be more than log2(n) prime factors.
List* factorAux(int n, int i)
{
if (i > n) return NULL;
else if divisible(n,i) return cons(i, factor(n/i, i));
else return factor(n, i + 1);
}
List * factor(int n) { return factorAux(n,2); }
Yeah, now clean up your allocations after your done. Now imagine that with a tree structure, and branches that might not have remained in the final result.
Name:
Anonymous2007-08-27 23:33 ID:S5UfSz07
still don't like it?
int factor(int n, int* array)
{
int i = 2;
int* begin = array;
while(!(i > n))
{
if(divisible(n,i)
{
*array++ = i;
n \= i;
}
else i++;
}
return array - begin;
}
>>61 >>63 >>67
Wow, you're such an idiot. You don't understand the semantic difference do you. They are similar yet in the standard they are not the same. You fail. Even worse your stupid idiotic code:
printf("%d", malloc(x)/malloc(x[0]));
Good job asshole, printing %d of whatever random value is in x? You just probably just tried to allocate millions of bytes of memory, twice! Or divide by zero if you're lucky.
You're owned, beaten, embarassed, even worse: YOU'RE WRONG. Get the fuck out of /prog/ you goddamn idiot, you can't even code your way out of an example.
Name:
Anonymous2007-08-28 9:45 ID:Kc1/6BO7
>>61 >>63 >>67
Wow, you're such an idiot. You don't understand the semantic difference do you. They are similar yet in the standard they are not the same. You fail. Even worse your stupid idiotic code:
<?php echo "welcum 2 my website"; HitCounter(); ?>
Good job asshole, printing a dumb welcome message. You just probably just tried to allocate millions of bytes of memory, twice! Or divide by zero if you're lucky.
You're owned, beaten, embarassed, even worse: YOU'RE WRONG. Get the fuck out of /prog/ you goddamn idiot, you can't even code your way out of an example.
Name:
Anonymous2007-08-28 10:44 ID:NlNof81+
>>71
well, >>63 isn't me but >>67 and >>61 are the same troll. so congratulations you won