title: how to add +4 in an array address in MIPS
body: <p>i am trying to use a loop to store say '2' integers to an array. So i thought i will use a loop that goes on 2 times, and each times it store a number in Array1 + cngAdd , where i will initialize cngAdd to 0 at beginning, and increase it by 4 at the end of loop. so at second iteration of loop the address is added by 4.</p>
  
  <p>So to read the input i do:</p>
  
  <pre><code>li $t7, 2
  li $t6, 1
  
  intReadStore:   
  
  li  $v0, 5
  syscall
  sw $v0, Array1 + cngAdd
  
  lw $t0, cngAdd
  li $t0, $t0, 4
  sw $t0, cngAdd
  
  li $t6, $t6, 1
  ble $t6, $t7, intReadStore
  </code></pre>
  
  <p>But in qtspim i get an error in this statement : sw $v0, Array1 + cngAdd</p>
  
  <p>Could you please tell what should i use instead of cngAdd (so that i change the address by + 4 , using some variable , or by even using any general purpose integer register, without hardcoding "4")?</p>
  
  <p>Note: my data are: </p>
  
  <pre><code>.data
   cngAdd    .word    0
   Array1    .space   2
  </code></pre>
  
  <p>my Array1 is of 2 integers here but i want to do it for 'n'. however for this question 2 is sufficient i think.</p>
  
  <p>thanks.</p>