"x01" [0] 为什么字符串末尾存在 [0]

"x01"[0] Why at the end of the string is present [0]

本文关键字:存在 字符串 为什么 x01      更新时间:2023-10-16

我在很多论坛上搜索过,但没有找到问题的答案:

正在尝试了解我的3D打印机(Marlin固件)中的软件,我找到了这个c ++代码:

#define LCD_STR_BEDTEMP     "x00"
#define LCD_STR_DEGREE      "x01"
#define LCD_STR_THERMOMETER "x02"
#define LCD_STR_UPLEVEL     "x03"
#define LCD_STR_REFRESH     "x04"
#define LCD_STR_FOLDER      "x05"
#define LCD_STR_FEEDRATE    "x06"
#define LCD_STR_CLOCK       "x07"
#define LCD_STR_ARROW_RIGHT "x7E"  /* from the default character set */
lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
lcd.createChar(LCD_STR_DEGREE[0], degree);
lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
lcd.createChar(LCD_STR_REFRESH[0], refresh);
lcd.createChar(LCD_STR_FOLDER[0], folder);
lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
lcd.createChar(LCD_STR_CLOCK[0], clock);

lcd.createChar Arduino 命令我没有问题,但我不明白的部分是为什么所有#define字符串都以 [0] 结尾?

感谢您的任何帮助。

所有宏都会生成始终以 \0 结尾的字符串文字。请出示lcd.createChar功能的签名。也许会更清楚问题是什么。