title: How to loop through allocated memory with pointer arithmetic C
body: <p>In order to loop through a regular int array with pointer arithmetic looks like such:</p>
  
  <pre><code> int *p;
   int arraySize = 20;
  
   int array[arraySize];     
  
   for (p = array; p&lt; array+(sizeof(array)/sizeof(int)); p++){
      int random = rand() % 200;
      *p = random;
    }
  
   for (p = array; p&lt; array+(sizeof(array)/sizeof(int)); p++){
      printf("%d\t%x\n", *p, p);
    }
  
  
  
   for (p = array; p&lt;array+(sizeof(array)/sizeof(int)); p++){
          int random = rand() % 200;
          *p = random;
    }
  
   for (p = array; p&lt; array+(sizeof(array)/sizeof(int)); p++){
          printf("%d\t%x\n", *p, p);
    }
  </code></pre>
  
  <p>However, I want to declare:</p>
  
  <pre><code>int *array = (int*) calloc(arraySize, sizeof(int));
  </code></pre>
  
  <p>I am very confused on how to loop through dynamically allocated memory as opposed to a regular static array.</p>