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

56 lines
963 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.
# Update
Changes the element at the specified array position.
```
bool  Update(
   int     pos,         // position
   string  element      // value
   )
```
Parameters
pos
[in] Position of the element in the array to change
element
[in] New value of the element
Return Value
true - successful, false - cannot change the element.
Example:
```
//--- example for CArrayString::Update(int, string)
#include <Arrays\ArrayString.mqh>
//---
void OnStart()
  {
   CArrayString *array=new CArrayString;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- add arrays elements
   //--- . . .
   //--- update element
   if(!array.Update(0,"ABC"))
     {
      printf("Update error");
      delete array;
      return;
     }
   //--- delete array
   delete array;
  }
```