Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CSimpleArray::Find

CSimpleArray::Find 

Finds an element in the array.


int Find(
   const T& t 
) const;

Parameters

t

The element for which to search.

Returns the index of the found element, or -1 if the element is not found.

// Create an array of floats
// and search for a particular element

   CSimpleArray<float> fMyArray;
   for (int i=0; i<10; i++)
      fMyArray.Add((float)i*100);
   int e = fMyArray.Find(200);
   if (e == -1)
      printf("Could not find element\n");
   else
      printf("Found the element at location %d\n",e);

Community Additions

ADD
Show:
© 2015 Microsoft