Insert

Insere um elemento no array para uma posição específica.

bool  Insert(
   char  element,     // Element to insert
   int   pos          // Position
   )

Parâmetros

element

[in]  O valor do elemento para ser inserido no array

pos

[in]  Posição no array para inserir

Valor do Retorno

verdadeiro se com sucesso, falso - não pode inserir o elemento.

Exemplo

//--- example for CArrayChar::Insert(char,int)
#include <Arrays\ArrayChar.mqh>
//---
void OnStart()
  {
   CArrayChar *array=new CArrayChar;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- insert elements
   for(int i=0;i<100;i++)
     {
      if(!array.Insert(i,0))
        {
         printf("Insert error");
         delete array;
         return;
        }
     }
   //--- use array
   //--- . . .
   //--- delete array
   delete array;
  }