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