title: Loop doesn't end
body: <pre><code>int main(void){
  
      int range = 0, i = 0;
  
      printf("Enter the number of digits of the number: ");
      scanf("%d", &amp;range);
  
      int a[range];
      int b[range];
  
      printf("Enter the number: ");
      for(i = 0; i &lt; range; i++){
              scanf("%1d", &amp;a[i]);
      }
  
      replace(a, b, range);
  
      swap(&amp;b[0],&amp;b[range]);
  
      printf("Output: ");
      for(i = range; i &gt; 0; i--){
              printf("%d", b[i]);
      }
  
      return 0;
  }
  
  void replace(int *a, int *b, int n){
      int *p;
      int temp;
  
      for(p = a; p &lt; a + n; p++){
              temp = ((*p + 6) % 10) / 10;
              p = b;
              *p = temp;
  
      }
   }
  
    void swap(int *p, int *q)
   {
      int temp;
  
      temp = *p;
      *p = *q;
      *q = temp;
   }
  </code></pre>
  
  <p>My problem is with the first for loop, the loop seems to just keep taking in input and doesn't end. I tried putting a print statement before the replace method and it didn't print so I knew the problem was with the for loop. How do I fix this issue?</p>