title: How can I move to a pointer position directly without using the ++ operator?
body: <p>I'm working with a pointer to a structure. I want to know if is possible move directly to a specific position without use <code>++</code> operator. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define ARRAY_SIZE 10
  
  struct dummy{
      int id;
      char buffer[10];
  };
  
  typedef struct dummy dummy_struct;
  
  int main()
  {
      int i=0;
      dummy_struct *ds = malloc(sizeof(dummy_struct)*ARRAY_SIZE);
      dummy_struct *iterator = ds;
  
      for(i=0;i&lt;ARRAY_SIZE;i++)
      {
          iterator-&gt;id = i;
          sprintf(iterator-&gt;buffer,"%d",i);
          iterator++;
      }
  
      iterator = ds;
  
      for(i=0;i&lt;ARRAY_SIZE;i++)
      {
          printf("%d:%s:%p\n",iterator-&gt;id,iterator-&gt;buffer,iterator);
          iterator++;
      }
  
      // I want to access directly to 5th position
      iterator = ds + (sizeof(dummy_struct)*5);
      printf("5th position %d:%s:%p\n",iterator-&gt;id,iterator-&gt;buffer,iterator);
  
      return 0;
  }
  </code></pre>
  
  <p>This statement</p>
  
  <pre><code>iterator = ds + (sizeof(dummy_struct)*5);
  </code></pre>
  
  <p>is not working. I will appreciate any suggestion.</p>