title: Redeclaring identifier in nested block in C
body: <p>I have a pointer to an array of integers in a main function to which I assign a block of memory dynamically allocated so that I have a 2D matrix.</p>
  
  <p>Something like:</p>
  
  <pre><code>int (*b)[m] = malloc(m*m*sizeof( ... etc ...
  </code></pre>
  
  <p>But I then need to redeclare (flatten out) this matrix in a nested block, within which I first simply used the same identifier (out of sheer laziness perhaps):</p>
  
  <p>so in the nested scope:</p>
  
  <pre><code>{
      int *b = (int *) b;
      ...
      ...
  }
  </code></pre>
  
  <p>Then I call a function inside that nested scope with the new local b, but it segfaults!
  However if within the same nested block I do this:</p>
  
  <pre><code>{
      int *d = (int *) b;
      int *b = d;
      ...
      ...
  }
  </code></pre>
  
  <p>Just because I use a temporary new d variable and then redeclare b locally initializing it to d, everything works perfectly as expected! So I seem not to be able to declare and initialize a variable
  with the same name (shadow) as in the outside scope.</p>
  
  <p>Any clue as to why?</p>