title: Debug Assertion Failed in Microsoft Visual C++ Runtime Library
body: <p>I'm trying to run the executable of this code but I'm having problems when creating it, specifically with the debug assertion error in VS. I have a screenshot of the error here and I see it mentions something about &quot;istype.cpp&quot; but it should be a .c program (it's named Project2.c and I've saved several times). I've also included a screenshot of the exception that's thrown in the debug screen. I've tried running in both x86 and x64 so I'm really not sure what it could be.
  <a href="https://i.stack.imgur.com/3RlWU.png" rel="nofollow noreferrer">error screenshot here.</a>
  <a href="https://i.stack.imgur.com/cJn3O.png" rel="nofollow noreferrer">debug breakpoint here.</a></p>
  <p>(just went through it again and fixed the if block but still not luck)
  the for loop in incomplete right now because I'm trying to work step by step to get everything working properly from the start, eventually it's going to be used to sort through a file finding digits and increasing the numValues by 1 each time one is found.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;ctype.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  void swap(int *a, int *b)
  {
      int temp = *a;
      *a = *b;
      *b = temp;
  }
  
  void heapify(int arr[], int n, int i)
  {
      int largest = i;
      int left = 2 * i + 1;
      int right = 2 * i + 2;
      
      if (left &lt; n &amp;&amp; arr[left] &gt; arr[largest])
      {
          largest = left;
      }
      
      if (right &lt; n &amp;&amp; arr[right] &gt; arr[largest])
      {
          largest = right;
      }
      
      if (largest != i)
      {
          swap(&amp;arr[i], &amp;arr[largest]);
          heapify(arr, n, largest);
      }
  }
  
  int main(int argc, char *argv[])
  {
      
      int numValues = 0;
      int n = sizeof(argv) / sizeof(argv[0]);
      
      for (int i = 0; argv[i] != '\0'; i++)
      {
          if (isdigit(argv[i]) != 0)
              ;
          numValues++;
      }
      
      return 0;
  }
  </code></pre>