Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/1721-standardlibrary-datastructures-carraystring-carraystringadd.md
T
2026-06-23 21:47:51 +08:00

54 lines
952 B
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Add
Adds an element to the end of the array.
```
bool  Add(
   string  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 CArrayString::Add(string)
#include <Arrays\ArrayString.mqh>
//---
void OnStart()
  {
   CArrayString *array=new CArrayString;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- add arrays elements
   for(int i=0;i<100;i++)
     {
      if(!array.Add(IntegerToString(i)))
        {
         printf("Element addition error");
         delete array;
         return;
        }
     }
   //--- use array
   //--- . . .
   //--- delete array
   delete array;
  }
```