answersLogoWhite

0


Best Answer

It is not certain if the question asked to convert lower case to upper case, or upper case to lower case. This answer assumes the latter. You could easily change this around for the former.

ConvertToLower (char*psz) {

while (*psz != '\0') {

switch (*psz) {

case 'A': *psz = 'a'; break;

case 'B': *psz = 'b'; break;

case 'C': *psz = 'c'; break;

case 'D': *psz = 'd'; break;

case 'E': *psz = 'e'; break;

case 'F': *psz = 'f'; break;

case 'G': *psz = 'g'; break;

case 'H': *psz = 'h'; break;

case 'I': *psz = 'i'; break;

case 'J': *psz = 'j'; break;

case 'K': *psz = 'k'; break;

case 'L': *psz = 'l'; break;

case 'M': *psz = 'm'; break;

case 'N': *psz = 'n'; break;

case 'O': *psz = 'o'; break;

case 'P': *psz = 'p'; break;

case 'Q': *psz = 'q'; break;

case 'R': *psz = 'r'; break;

case 'S': *psz = 's'; break;

case 'T': *psz = 't'; break;

case 'U': *psz = 'u'; break;

case 'V': *psz = 'v'; break;

case 'W': *psz = 'w'; break;

case 'X': *psz = 'x'; break;

case 'Y': *psz = 'y'; break;

case 'Z': *psz = 'z'; break;

}

psz++;

}

Warning. Do not be tempted to replace the switch statement with ...

if (*psz >= 'A' && *psz <= 'Z') *psz += 32;

... because that will only work on ASCII implementations, and it is most definitely not portable, such as in EBCDIC implementations.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write program to convert a string in lower case without using library function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a Program to convert decimal number into hexadecimal no without using function and string?

This is not a question.


Can we execute java program without main function?

no


Can you write a program without specifying the prototype of any function?

You can write a program without specifying its prototype when the function returns an integer.If the prototype is not mentioned the compiler thinks that the return type of the function used is integer.When making program which return integer you can ignore writing the protoype.


Function of power supply?

to convert AC into DC voltage without fluctuation


Write a program in C without any functions?

It is not possible. In C, any program must have at least one function to be able to compile and execute properly: the function main()


Can you convert a mov file without using an on-line converter or downloading anything?

No. Not unless you have a video editing program that has a converter integrated into the program.


Is it possible to convert a string into integer without using any function in c?

Yes


What is the importance of using functions in a c program?

C programs do not function without functions.


Example program for setpixel function in c language?

C does not define a setpixel() function; it is a non-standard function. C is intended for general-purpose programming but graphics handling is system-specific. There are third-party libraries available to cater for graphics handling (many of which are generic) but without knowing which library you are using nor on which platform, it would be impossible to demonstrate a setpixel() function in any meaningful way. Best advice is to consult the documentation that came with your graphics library.


A c program to call a function without using function name?

It can be done via its address, for example: void function (void (*callback)(void)) { (*callback)(); }


What is string library functions syntax?

String library function is one which is used to perform an operation in C-programming,without which library functions likestrlen(),strcp(),strcmp(),strdup(),strrev(),etc..,.can be performed


Can you write a program without using any semicolon inside the main function?

not possible dude