54 lines
931 B
Markdown
54 lines
931 B
Markdown
# Add
|
||
|
||
Adds an element to the end of the array.
|
||
|
||
```
|
||
bool Add(
|
||
float element // element to add
|
||
)
|
||
|
||
```
|
||
|
||
Parameters
|
||
|
||
element
|
||
|
||
[in] Value of the element to add to the array.
|
||
|
||
Return Value
|
||
|
||
true - successful, false - cannot add an element.
|
||
|
||
Example:
|
||
|
||
```
|
||
//--- example for CArrayFloat::Add(float)
|
||
#include <Arrays\ArrayFloat.mqh>
|
||
//---
|
||
void OnStart()
|
||
{
|
||
CArrayFloat *array=new CArrayFloat;
|
||
//---
|
||
if(array==NULL)
|
||
{
|
||
printf("Object create error");
|
||
return;
|
||
}
|
||
//--- add arrays elements
|
||
for(int i=0;i<100;i++)
|
||
{
|
||
if(!array.Add(i))
|
||
{
|
||
printf("Element addition error");
|
||
delete array;
|
||
return;
|
||
}
|
||
}
|
||
//--- use array
|
||
//--- . . .
|
||
//--- delete array
|
||
delete array;
|
||
}
|
||
|
||
```
|