This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于如何让CCS5.2编译器结构体按字节对齐



是这样的,在CCS5.2编译器中,我想定义一个共用体如union data
{
char buff [100];
strcut shuju
{
int aa;
char bb;
int ee;
.....
.....
}data;
}
现在我把接收到的数据转换后存到data里边;然后我就想直接将buff发送出去(因为是共用体,所以buff和data共用相同内存)
但是由于结构体不是按字节对齐的,导致数据和buff对应不上;使得接收到的数据不正确,在CCS5.2编译器里如何让结构体按
字节对齐呢,网上找了很久都没有解决办法。哪位工程师大神知道怎么解决呢