Whats the difference between strlwr() and tolower()?

Recommended Answers

All 6 Replies

Biggest difference is tolower() is a standard function and strlwr() is specific to certain compilers, non standard. tolower() converts 1 character. strlwr() converts a string

Biggest difference is tolower() is a standard function and strlwr() is specific to certain compilers, non standard. tolower() converts 1 character. strlwr() converts a string

I thought since you need #include <ctype.h> for tolower() it is not standard. Why would you have to include #include <ctype.h> if it is a standard function?

Because it's a standard header.

Because it's a standard header.

Whats a standard header? I'm not familiar with that.

I thought since you need #include <ctype.h> for tolower() it is not standard. Why would you have to include #include <ctype.h> if it is a standard function?

All functions have to be declared before they can be used, whether they are standard C functions or not. Standard functions are not the same as C keywords as keywords are not functions, and there are no header files for them. There are lots of standard header files, and ctype.h is just one of them. Among the most used standard heder files are stdio.h, string.h and stdlib.h

C and C++ are designed around standard keywords, functions, and headers as defined by The Standards Committee, or whatever they are officially called. Many (most) compilers will add additional functions they like. These are usually functions they feel were missed by the Standards committee. They may add them to a standard header or they may create a header specifically for these functions.

conio.h is the most notorious of these headers. And because of that, new programmers who are introduced to conio.h tend to wonder what's wrong when they switch compilers. "Where's my darn function" is their mantra. I know, because I was one of them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.