Assume again that the array address (i.e., address of a[0]) is
-72(%ebp)
and the variable i is stored in memory at:
-4(%ebp)
What assembler code would do this:
a[i] = 100;
Answer: First the address of a[i] would be
-72(%ebp) + 4 * i
But the compiler could have generate code that does the multiplication during execution since the value of i is not a constant.
movl -4(%ebp), %eax movl $100, -72(%ebp, %eax, 4)