title: Simple program crashes after using switch - C
body: <p>I just have written a program which suppose to return char which appears the most/least. Program work during the testing without switch statement, but when I added it start to crash. Can you have a look?</p>
  
  <blockquote>
    <p>Main function</p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "tools.h"
  
  int main(int argc, char *argv[]) {
      int count[256] = { 0 };
      int c;
      while ( (c=getchar())!=EOF ){
          count[c]++;
      }
      switch (argv[1][1]) {
      case 'm': case 'M':
          mostOften(count);
          break;
      case 'l': case 'L':
          leastOften(count);
          break;
      default:
          mostOften(count);
          break;
      }
      return 0;
  }
  </code></pre>
  
  <blockquote>
    <p>Tools function</p>
  </blockquote>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "tools.h"
  
  void mostOften(int *s) {
      int j;
      int max, cha;
      for(j=32; j&lt;126; j++){
          if(s[j]&gt;max) {
                  max=s[j];
                  cha=j;
          }
      }
      printf("char %c: %d times\n", cha, max);
  }
  
  void leastOften(int *s) {
      int j;
      int min=10000, cha;
      for(j=32; j&lt;126; j++){
          if(s[j] &amp;&amp; s[j]&lt;=min) {
                  min=s[j];
                  cha=j;
          }
      }
      printf("char %c: %d times\n", cha, min);
  }
  </code></pre>