title: recursive function error Dev-C++
body: <p>I have the following code sequential search run perfectly in Visual C++</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int seqSearch(int list[], int length, int item)
  {
      int index = length-1;
      if (index &lt; 0)
          return -1;
      if (list[index] == item)
          return (index);
      else seqSearch(list, index, item);
  } // end seqSearch
  
  int main () 
  {
  
      int const length = 10;
      int item;
      int list[10] = { 2, 3, 4, 5, 20, 40, 80, 45, 99, 0};
  
      cout &lt;&lt; "Please enter the value to be searched: ";
      cin&gt;&gt; item;
  
      if (seqSearch(list, length, item) == -1) cout &lt;&lt; "Item not found." &lt;&lt; endl;
      else cout &lt;&lt;"Item found at position: " &lt;&lt; seqSearch(list, length, item) &lt;&lt; " of list *Note: (first index of list start at 0)" &lt;&lt; endl;
  
      system("pause");
      return 0; 
  }
  </code></pre>
  
  <p>But in Dev-C++ it always display result 0, I tried to debug and see index is correct but why it display 0? Why we have this difference between VC++ and Dev-C++?</p>