title: Comparing characters in C
body: <p>I have a question about comparing a single char of a string in C inside a function.
  The code looks like this:</p>
  
  <pre><code>int fq(char *s1){
  int i;
  for(i=0;i&lt;strlen(s1);i++){
      if(s1[i]=="?"){
          printf("yes");
      }
  }
  return 1;
  }
  </code></pre>
  
  <p>Even if s1="???" it never prints out yes. I have managed to solve the problem but i am curious as to why it works one way but not the other.
  This is the piece of code that works:</p>
  
  <pre><code>int fq(char *s1,char *s2){
  int i;
  char q[]="?";
  for(i=0;i&lt;strlen(s1);i++){
      if(s1[i]==q[0]){
          printf("yes");
      }
  }
  return 1;
  }
  </code></pre>