# ArraySwap Swaps the contents of two dynamic arrays of the same type. For multidimensional arrays, the number of elements in all dimensions except the first one should match. ``` bool  ArraySwap(    void&  array1[],      // first array    void&  array2[]       // second array    ); ``` Parameters array1[] [in][out]  Array of numerical type. array2[] [in][out]  Array of numerical type. Return Value Returns true if successful, otherwise false. In this case, [GetLastError()](/en/docs/check/getlasterror) returns the [ERR_INVALID_ARRAY](/en/docs/constants/errorswarnings/errorcodes) error code. Note The function accepts dynamic arrays of the same type and the same dimensions except the first one. For integer types, the sign is ignored, i.e. [char](/en/docs/basis/types/integer/integertypes)==uchar) Example: ``` //+------------------------------------------------------------------+ //| Script program start function                                    | //+------------------------------------------------------------------+ void OnStart()   { //--- arrays for storing quotes    double source_array[][8];    double   dest_array[][8];    MqlRates rates[]; //--- get the data of the last 20 candles on the current timeframe    int copied=CopyRates(NULL,0,0,20,rates);    if(copied<=0)      {       PrintFormat("CopyRates(%s,0,0,20,rates) failed, error=%d",                   Symbol(),GetLastError());       return;      } //--- set the array size for the amount of copied data    ArrayResize(source_array,copied); //--- fill the rate_array_1[] array by data from rates[]    for(int i=0;i