title: C Function that returns number of X, Y, Z characters in a string and how to call it?
body: <p>I need some help solving this. I am pretty new to C so this is giving me some trouble. I can do it fine with 3 functions that each return 1 value like this: </p>
  
  <pre><code>int cnt(char x, char *s) {
      int b=0;
  
      while(*s)
      {
          if(*s++== x) b++;
      }
  
      return b;
  }
  </code></pre>
  
  <p>I do 3 of those and then just call them separately in main. The thing is I wanna do it with just one function. I have a general idea on how the function would work, but I have no idea how to call it. Would really be thankful for a solution to my little problem. </p>