Do you want the merged array to be in sorted order? If so, then you'll have to call bubblesort function again after calling merge function.