tolower()功能无法在C99中工作

Cha*_*ies 7 c tolower cs50

我正在使用哈佛的CS50设备并尝试将字符设为小写.我正在尝试使用该tolower()功能,但当我尝试使用它时,我收到了消息implicit declaration of function 'tolower' is invalid in C99.任何人都在关注为什么我会收到这条消息.我已经包括stdio.h,以及string.h.

Gab*_*abe 15

tolower在C99中使用,请使用#include <ctype.h>

它不是I/O函数,它不对字符串进行操作(它对字符进行操作),因此它不在stdio或中string.

  • character [0] ='A'应该有效.通过执行字符[0] ="A",您尝试将字符串分配给字符,这是不允许的. (2认同)

eps*_*lon 5

tolower定义于ctype.h. 这是您应该包含的文件:

#include <ctype.h>
Run Code Online (Sandbox Code Playgroud)

会解决你的问题。