you're doing

left[++j] = A[i];

while your i is from 1 to 5
your array indexes are 0 to 4

that should help you figure out the problems