3. Arrange data of various types in the stack
Stack growth mode: from high address to low address
Data storage method:
For example, the long data stored in the memory is 0x12345678
A. High-end method (gig endian)
High byte (high) => low address
Low byte (low) => high address
|----------|
0x2003 | 78 | high address
|----------|
0x2002 | 56 |
|----------|
0x2001 | 34 |
|----------|
0x2000 | 12 | low address
|----------|
Array Storage Method (large-end method ):
For example, int A [8];
|----------|
a[7], 0x2017 | 80 | high address
|----------|
a[6], 0x2016 | 70 |
|----------|
a[5], 0x2015 | 60 |
|----------|
a[4], 0x2014 | 50 |
|----------|
a[3], 0x2013 | 40 |
|----------|
a[2], 0x2012 | 30 |
|----------|
a[1], 0x2011 | 20 |
|----------|
a[0], 0x2010 | 10 | low address
|----------|
B. little endian)
High byte (high) => high address
Low byte (low) => low address
|----------|
0x2003 | 12 | high address
|----------|
0x2002 | 34 |
|----------|
0x2001 | 56 |
|----------|
0x2000 | 78 | low address
|----------|