65 lines
1.3 KiB
Markdown
65 lines
1.3 KiB
Markdown
# AssignArray
|
||
|
||
Copies the elements of one array to another.
|
||
|
||
```
|
||
bool AssignArray(
|
||
const CArrayString* src // pointer to the source
|
||
)
|
||
|
||
```
|
||
|
||
Parameters
|
||
|
||
src
|
||
|
||
[in] Pointer to an instance of the CArrayString class used as a source of elements to copy.
|
||
|
||
Return Value
|
||
|
||
true - successful, false - cannot copy the elements.
|
||
|
||
Example:
|
||
|
||
```
|
||
//--- example for CArrayString::AssignArray(const CArrayString*)
|
||
#include <Arrays\ArrayString.mqh>
|
||
//---
|
||
void OnStart()
|
||
{
|
||
CArrayString *array=new CArrayString;
|
||
//---
|
||
if(array==NULL)
|
||
{
|
||
printf("Object create error");
|
||
return;
|
||
}
|
||
//--- create source array
|
||
CArrayString *src =new CArrayString;
|
||
if(src==NULL)
|
||
{
|
||
printf("Object create error");
|
||
delete array;
|
||
return;
|
||
}
|
||
//--- add source arrays elements
|
||
//--- . . .
|
||
//--- assign another array
|
||
if(!array.AssignArray(src))
|
||
{
|
||
printf("Array assigned error");
|
||
delete src;
|
||
delete array;
|
||
return;
|
||
}
|
||
//--- arrays is identical
|
||
//--- delete source array
|
||
delete src;
|
||
//--- use array
|
||
//--- . . .
|
||
//--- delete array
|
||
delete array;
|
||
}
|
||
|
||
```
|