title: Find char* element in array of char* in C++
body: <p>I'm trying to write function that search for <code>char *</code> element in array of <code>char*</code> and the function start check this element, if the element exist in the array I will have "found", if not it should be "inserted" and the element added to the array.</p>
  
  <p>I wrote this code but I cannot know how to try it, the program always gives me exception, what can I do to check the element in my pointer array?</p>
  
  <pre><code>void checkFunction(char*myArray[], char *element,bool flag)
  {
      for (int i = 0; i &lt; strlen(*myArray) ; ++i)
      {
          if (myArray[i] == element)
          {
              flag = true;
          }
      }
      *myArray = element;
      flag = false;
  
      if (flag)
      {
          cout &lt;&lt; "Found" &lt;&lt; endl;
      }
      else
      {
          cout &lt;&lt; "Inserted" &lt;&lt; endl;
      }
  }
  </code></pre>