title: Pointer as index value in for loop
body: <p>I'd like to use a few <code>for</code> loops in C and use common index for these. I want to use pointer, because I will be able to free it later.<br>
  I thought about something like:</p>
  
  <pre class="lang-c prettyprint-override"><code>uint8_t *p = malloc(sizeof(uint8_t));
  
  for (*p = 0; *p &lt; 255; *p++)
  {
    // Instructions...
  }
  
  // A few loops...
  
  free(p);
  </code></pre>
  
  <p>But this code doesn't work as I want. How can I fix it?</p>
  
  <p>PS I'm a beginner in C's pointers.</p>