title: Error in "if not true" - C
body: <p>I'm kinda new in C so I don't know if im allowed do to the following "if" in C, my error happens in the if line but the error is a segmentation fault, that should be a uninitialized variable but i give her a value from a file...well, there is the code:</p>
  
  <pre><code>char t1, ch;
  if((fscanf(f,"P%d", &amp;t1)) == 1){
  
  if(!((strcmp(t1,"P2")==0) || (strcmp(t1,"P5")==0))){ // error here
  fprintf(stderr, "\nTipo de imagem invalido.\n");
        fclose(f);
        return NULL;
  }
  </code></pre>
  
  <p>If anyone can help me i will appreciate...
  Thank you in advance!</p>