title: Converting char array to (negative) integer; does not compile because of "array - '0'" line
body: <p>So I've got this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
      char arr[BUFSIZ];
      arr[BUFSIZ - 1] = '\0';
      fgets(arr, sizeof(arr), stdin);
      int x = arr - '0';
      printf("%d\n", x);
  }
  </code></pre>
  
  <p>and when I try to compile it, using clang's make, I get this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ make test
  clang -ggdb3 -O0 -std=c99 -Wall -Werror    test.c  -lm -o test
  test.c:9:9: error: incompatible pointer to integer conversion initializing 'int'
        with an expression of type 'char *' [-Werror,-Wint-conversion]
      int x = arr - '0';
          ^   ~~~~~~~~~
  1 error generated.
  </code></pre>
  
  <p>It doesn't matter if I comment or uncomment the <code>arr[BUFSIZ - 1] = '\0';</code> line, this just won't compile.</p>
  
  <p>I've read that <code>int x = arr - '0';</code> <em>should</em> do the trick, but it does not..</p>