stm32f100数组赋值问题

2019-07-14 17:09发布

uint8_t buf[10];
buf[0] = 33;
buf[1] = 34;
结果是
buf[0]  33
buf[1]  34
buf[2]  34
有没有人碰到过这种情况,帮我看下是哪里不对
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
10条回答
bctwerwer
2019-07-15 04:15
回复第 5 楼 于2014-08-17 15:06:36发表:
这数组是存放在什么地方的,贴出完整的程序吧。
#include "includes.h"
 
int main (void)
{
        uint8_t i;
        uint8_t buf[10] = {33,34,35,0};
  /*!< At this stage the microcontroller clock setting is already configured, 
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */     
        i = i;
        i = 0;
        buf[0] = 33;
        buf[1] = 36;
       
        sprintf((char*)&buf, "!#$");
//        buf = {}
//        buf[2] = 0;
 
        sprintf((char*)&buf, "文");
       
        while(1)
        {
 
        }
}
 
/**********************ends of file*******************************************/
 
 

一周热门 更多>