ChapmIndustries
ChapmIndustries

Reputation: 1531

tolower() Function not Working in C99

I am using the CS50 appliance from Harvard and trying to make a character lowercase. I am trying to use the tolower() function but when I try to use it I get the message implicit declaration of function 'tolower' is invalid in C99. Anyone care to elaborate on why I would be getting this message. I have included stdio.h as well as string.h.

Upvotes: 8

Views: 13512

Answers (3)

Gabe
Gabe

Reputation: 86768

To use tolower in C99, use #include <ctype.h>

It is not an I/O function and it doesn't operate on strings (it operates on characters), so it's not in stdio or string.

Upvotes: 20

epsalon
epsalon

Reputation: 2294

tolower is defined in ctype.h. That is the file you should be including:

#include <ctype.h>

will solve your problem.

Upvotes: 5

Jesus Ramos
Jesus Ramos

Reputation: 23266

It's defined in ctype.h not in those headers that you mentioned.

Upvotes: 1

Related Questions