Quote Originally Posted by iMalc View Post
This could just be an else:
Code:
    else if(array2[n2] <= array1[n1])
That's a very different way of doing it than I'm used to, but it looks like it should work.

key4life: I would actually recommend using three indexes, one for each array. Try writing it yourself, doing that. The usual method is to merge the arrays until one of them reaches its ending index, and then you perform a separate loop to copy all remaining items from the other array.
I've never coded a merge array function using a for loop. Usually use two while loops (one for the main part, and one for the longer array "leftovers").

Looking at this, it seems inefficient to have the tip portion inside the main for loop. It would be better having it outside. Keep the loops as small and tight as possible.

Good catch on the else if.