Basic and Advance C Question:
Download Questions PDF

How do I convert a string to all upper or lower case?

Answer:

Some libraries have routines strupr and strlwr or strupper and strlower, but these are not Standard or portable. It's a straightforward exercise to write upper/lower-case functions in terms of the toupper and tolower macros in <ctype.h>;(The only tricky part is that the function will either have to modify the string in-place or deal with the problem of returning a new string;
(Note also that converting characters and strings to upper or lower case is vastly more complicated when multinational character sets are being used.)

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
Why do some versions of toupper act strangely if given an upper-case letter?why isnt it being handled properly?