# 針對動態宣告的陣列
考慮下面的程式
```c
int main() {
int x;
int y;
int c[3];
int a;
}
```
對於`stack`來說,可以將其存成下列的形式
```
sp-0 | x |
sp-4 | y |
sp-8 | c | <- value is sp-28
sp-12 | a |
sp-16 | c[3] |
sp-20 | c[2] |
sp-24 | c[1] |
sp-28 | c[0] |
sp-32 | |
```
對於`symbol table`來說,只要繼續維護`x y c a`的值就好了。不過這種作法當遇到陣列`c`時,要記得讀取兩次。
## 程式順序
1. alloca int x, x add to symbol table
2. alloca int y, y add to symbol table
3. alloca int c, c add to symbol table
4. alloca int a, a add to symbol table
5. get the expr of c array, alloca c array, store `&c[0]` to c