title: read-only variable from string is not assignable in for-loop C
body: <p>The program gets a string from input and looks for the n'th char in the string in a other inputted string. If the first char from the first string is in the second string the program will output the char if not it will print no char match. The programs looks as follows: </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(){
      const char s[1000], i;
  
      printf("Enter a string: ");
      scanf("%s", s);
  
      const char str1[1000];
  
      printf("Enter a string: ");
      scanf("%s", str1);
  
      // int b;
  
      for(i = 0; str1[i] != '\0'; ++i){
          b = i;
      }
  
      for(i = 0; i &lt; b; i++){
          char *ret;
          ret = strpbrk(s, s[i]);
          if(ret)
          {
              printf("First matching character: %c\n", *ret);
          }
          else
          {
              printf("no char match \n");
          }
      }
      return(0);
  }
  </code></pre>
  
  <p>The error is in the both of the for-loops and states: </p>
  
  <blockquote>
    <p>error: read-only variable not assignable</p>
  </blockquote>
  
  <p>Furthermore an error states: </p>
  
  <blockquote>
    <p>note: passing argument to parameter here</p>
  </blockquote>