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



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

Answer / Anant Singh

To convert a string to uppercase, you can use the `toupper()` function. To convert a string to lowercase, you can use the `tolower()` function. Here's an example of converting a string to uppercase:nn```cn#include <stdio.h>n#include <ctype.h>nnint main() {n char str[] = "Hello World!";n int i = 0;n while(str[i] != '') {n printf("%c", toupper(str[i]));n i++;n }nprintf("n");nreturn 0;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is p in text message?

1 Answers  


Write a c program to print the even numbers followed by odd numbers in an array without using additional array

1 Answers   Tech Mahindra,


errors in computer programmes are called

1 Answers   NET,


explain what is fifo?

1 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


What is the difference between malloc() and realloc()?

2 Answers  


Describe explain how arrays can be passed to a user defined function

1 Answers  


What is the scope of static variables in c language?

1 Answers  


write a program to fined second smallest and largest element in a given series of elements (without sorting)

9 Answers   Yahoo,


what is difference between ANSI structure and C99 Structure?

1 Answers   Wipro,


void main() { int a=1; while(a++<=1) while(a++<=2); }

4 Answers   HCL,


write a program which will count occurance of a day between two dates.

1 Answers   IonIdea,


Categories