I wrote this merge function for two sub-arrays of equal size(so the resulting array size is an even number). Although it works if size(of resulting array)<=6 but for any bigger number it crashes...
More specifically if I have:
int c[]={1,3,5,6};
int b[]={2,7,9,11};
int a[]={0,0,0,0,0,0,0,0};
merge(a,b,c,8)
it works...
If however I have:
int c[]={1,3,5,6};
int b[]={2,7,9,11};
int* a=new int(8);
merge(a,b,c,8);