I define a struct array struct smp { unsigned char attri; unsigned char data; } smp[50]; but I find the compiler make a gap between the array. In fact the ram is assigned as smp[0].attri smp[0].data gap[0] gap[1] smp[1].attri smp[1].data gap[0] gap[1] ... so the ram of gap can not be used, then half of the ram is wasted. how can I make the ram of gap to be useful? Can the ram be assign continuous as define a struct array? Can the ram be complied as smp[0].attri smp[0].data smp[1].attri smp[1].data smp[2].attri smp[2].data ... ?
"half of the ram is wasted" As Dan says, the compiler will have options to control this. However, the compiler does this because there will be a performance hit (quite probably a serious one) if your data is not correctly aligned. So you can save some RAM - but the cost will be reduced performance. You need to carefully consider which is most important to you...