title: Character occurrence in an array in C language
body: <p>This is my code to find the number of times a character is found in an array:</p>
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;string.h&gt;
  #include&lt;math.h&gt;
  
  int main(){
      int a[100],i,size,count;
      char c;
  
      printf(&quot;Enter the size of the array: &quot;);
      scanf(&quot;%d&quot;, &amp;size);
  
      printf(&quot;Enter the elements into the array: &quot;);
      for(i=0;i&lt;size;i++){
          scanf(&quot; %c&quot;, &amp;a[i]);
      }
  
      printf(&quot;Enter a character: &quot;);
      scanf(&quot; %c&quot;, &amp;c);
  
      for(i=0;i&lt;size;i++){
          if(a[i] == c){
              count++;
          }
      }
  
      printf(&quot;The number of occurrences of %c is %d.&quot;, c,count);
  
      return 0;
  }
  </code></pre>
  <p>This is the output I am getting:</p>
  <pre><code>Enter the size of the array: 5
  Enter the elements into the array: a q w w t
  Enter a character: w
  The number of occurrences of w is 2985985.
  </code></pre>
  <p>It is not printing the count value but some other value. What is wrong with my code and what does <code>2985985</code> mean?</p>