Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/1767-standardlibrary-datastructures-carrayobj-carrayobjcomparearray.md
T
2026-06-23 21:47:51 +08:00

55 lines
1.1 KiB
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.
# CompareArray
Compares the array with another one.
```
bool  CompareArray(
   const CArrayObj*  src      // pointer to the source
   ) const
```
Parameters
src
[in] Pointer to an instance of the CArrayObj class used as a source of elements for comparison.
Return Value
true - the arrays are equal - the arrays are not equal.
Example:
```
//--- example for CArrayObj::CompareArray(const CArrayObj*)
#include <Arrays\ArrayObj.mqh>
//---
void OnStart()
  {
   CArrayObj *array=new CArrayObj;
   //---
   if(array==NULL)
     {
      printf("Object create error");
      return;
     }
   //--- create source array
   CArrayObj *src=new CArrayObj;
   if(src==NULL)
     {
      printf("Object create error");
      delete array;
      return;
     }
   //--- fill source array
   //--- . . .
   //--- compare with another array
   int result=array.CompareArray(src);
   //--- delete arrays
   delete src;
   delete array;
  }
```