uint16_t e5_temp[2];
void program_ryb(uint8_t *buf)
{
uint8_t i;
uint8_t *ptr;
uint16_t sum_crc=0,
ptr=(uint8_t*)e5_temp;
for(i=0;i<2;i++)
{
ptr[i]=buf[i];
}
for(i=0;i<1;i++)
{
sum_crc+=e5_temp[i];
}
e5_temp[1]=0-sum_crc; //存放CRC校验(取补)
for(i=0;i<RYB_LEN/2;i++)
{
ryb_check[i]=e5_temp[i]; //存放CRC校验(取补)
}
}
keil MDK编译老出现错误
..\USER_CODE\deal_flash.c(74): error: #101: "ptr" has already been declared in the current scope
..\USER_CODE\deal_flash.c(74): error: #144: a value of type "uint8_t *" cannot be used to initialize an entity of type "uint16_t"
..\USER_CODE\deal_flash.c(78): error: #142: expression must have pointer-to-object type
30分钟彻底学会C语言指针