# Function Reference

# _ArrayConcatenate

Concatenate two arrays - either 1D or 2D with the same number of columns

#include <Array.au3>
_ArrayConcatenate ( ByRef $aArrayTarget, Const ByRef $aArraySource [, $iStart = 0] )

## Parameters

$aArrayTarget | The array to which the source array will be concatenated
$aArraySource | The array to concatenate to the target array
$iStart | [optional] index of the first Source array entry (Default = 0)

## Return Value

Success: | the number of elemets/rows in the new target array
Failure: | -1 and sets the @error flag to non-zero.
@error: | 1 - $aArrayTarget is not an array 2 - $aArraySource is not an array 3 - $aArrayTarget is not a 1D or 2D array 4 - $aArrayTarget and $aArraySource 1D/2D mismatch 5 - $aArrayTarget and $aArraySource column number mismatch (2D only) 6 - $iStart outside array bounds

## Remarks

The $iStart parameter is useful when concatenating arrays which have a count in the [0] element.
The function does NOT update any count element within the target array, but the return value of the function (if successful) gives the final number of rows in the concatenated array.

## Related

_ArrayAdd

## Example

    #include <Array.au3>

    Local $aArrayTarget[5] = ["0", "1", "2", "3", "4"]
    Local $aArraySource[5] = ["5", "6", "7", "8", "9"]

    _ArrayDisplay($aArrayTarget, "1D Target")
    _ArrayDisplay($aArraySource, "1D Source")
    _ArrayConcatenate($aArrayTarget, $aArraySource)
    _ArrayDisplay($aArrayTarget, "1D Target and Source concatenated")

    Local $aArrayTarget[4][3]
    For $i = 0 To 3
        For $j = 0 To 2
            $aArrayTarget[$i][$j] = $i & $j
        Next
    Next

    Local $aArraySource[4][3]
    For $i = 0 To 3
        For $j = 0 To 2
            $aArraySource[$i][$j] = (4 + $i) & $j
        Next
    Next

    _ArrayDisplay($aArrayTarget, "2D Target")
    _ArrayDisplay($aArraySource, "2D Source")
    _ArrayConcatenate($aArrayTarget, $aArraySource)
    _ArrayDisplay($aArrayTarget, "2D Target and Source concatenated")