ok this should work
for(int* ia=both,* ib=both;ib<&both[MAX_LENGTH_BOTH];ib+=*ia!=*ib)*ib=*ia++;