Now code [(x, y) for x in xrange(10) for y in (3, 4, 5, 10) if x < y] in C. It should return a mutable, dynamic, heterogeneous linked list of tuples (immutable, dynamic, heterogeneous and linked).
how about you implement this in whatever language that is: int factor(int num,int* factors){
int n=num,i,l=0;
if(num<2)return 0;
for(i=2;i<=num/2;++i){
while(!(n%i)){
n/=i;
factors[l++]=i;
}
}
if(!l){
l=1;factors[0]=num;
}
return l;
}
it should take an int and a pointer to enough memory to to hold all prime factors of the number as an int array, put the prime factors of the number into the array, and return the number of factors as an int.
for example, if you do int n=factor(12,factors);, n should be 3, factors[0] and factors[1] should be 2, and factors[2] should be 3.