Answer to Question #204934 in C for Ali khan

Question #204934

Write a program that converts all lowercase characters in a given string to its 

equivalent uppercase character. 


1
Expert's answer
2021-06-09T07:42:07-0400
#include <ctype.h>
#include <stdio.h>

int main()
{
    char* tmp;
    char str[] = "String Test One";
    printf("Source string: '%s'\n", str);

    tmp = str;
    while(*tmp)
    {
        if(islower(*tmp))
        {
            *tmp = toupper(*tmp);
        }

        ++tmp;
    }
    
    printf("Result string: '%s'\n", str);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS