Question

is there any way that I can capitalize argv, such as argv[1] = hello, and argv[2]...

is there any way that I can capitalize argv, such as argv[1] = hello, and argv[2] = world to argv[1] = HELLO, argv[2] = WORLD without using strlen or toupper or copy them into new arry?

Homework Answers

Answer #1
#include <stdio.h>

int main(int argc, char *argv[]) {
    if (argc > 1) {
        int i, j;
        for (i = 1; i < argc; ++i) {
            j = 0;
            while (argv[i][j]) {
                if (argv[i][j] >= 'a' && argv[i][j] <= 'z')
                    argv[i][j] -= 32;   // to change lowercase letter to uppercase letter subtract 32 from letter
                j++;
            }
            printf("%s\n", argv[i]);
        }
    }
    return 0;
}

// directly modified argv into uppercase (no libraries used)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4...
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4 5) 6 )7) to (list 1 2 3 4 5 6 7)?
Hello. for one of my assignment, I need to create any program using the C language...
Hello. for one of my assignment, I need to create any program using the C language and that must contain the following: - Error Checking - Use of Functions - Menu system - Array Processing It can be about anything, nothing specified but must contain the features mentioned above Thank you
Hello Everyone, I need to write a Python code for AES encryption and decryption for any...
Hello Everyone, I need to write a Python code for AES encryption and decryption for any text entered by the user. Can anyone please help me out with it? Thank you so much.
hello i do have Q about Management course (Human Resource Systems chapter) because i have a...
hello i do have Q about Management course (Human Resource Systems chapter) because i have a hard time to write , could any one help with this ?? here is the Q: You are the CEO and Founder of a new tech firm named Pilgrim. This firm has developed software that when traveling, automatically translates, maps your course, and purchases any transportation needs everyday while abroad. The software eliminates the need for translations as you speak into your microphone and...
Hello, Kindly I need a short description and new facts can people learn about " options...
Hello, Kindly I need a short description and new facts can people learn about " options trading " . Thank you!!
Hello, I need your support to solve below question with more explanation if possible,, - Can...
Hello, I need your support to solve below question with more explanation if possible,, - Can large firms in Saudi Arabia also be entrepreneurial? Is it in their interests to be so? what pressures are there for them not to be entrepreneurial? Thanks,.,
hello, my question is, how can i use implicit differentiation to calculate the optimal surface area...
hello, my question is, how can i use implicit differentiation to calculate the optimal surface area of a box. Or any type of optimization problem involving the use of implicit differentiation. an example would be appreciated
Hello! I need several Miscellaneous Household Items (Golgi Bodies and Chloroplasts. They have to be small...
Hello! I need several Miscellaneous Household Items (Golgi Bodies and Chloroplasts. They have to be small enough to fit them in a zip-load bag. Any examples?? I need differeng examples of what I can use as Golgi bodies and cloroplams. I'm making a animal and plant cell. I will be putting the things that will represent the Golgi bodies and Cloroplasm inside a zip-load bag with gelatin.
Hello, I have this problem from my Statistic class and I don't understand it. Can you...
Hello, I have this problem from my Statistic class and I don't understand it. Can you write step by step to solve this. A hospital keeps track of its emergency room traffic. The records indicate that beginning at 6:00 pm on any given day there will be 4 patients arriving per hour. Determine the probability that the third patient arrives between 6:15 pm and 6:30 pm.
How do I fix my error of binding on line 74? #include <iostream> #include <fstream> #include...
How do I fix my error of binding on line 74? #include <iostream> #include <fstream> #include <cctype> #include <cstring> #include <iomanip> using namespace std; #include "AvlTree.h" class WordCount { public:     char *word;     int *lines;     int count;     int size;     bool operator<(const WordCount &rhs) const {return strcmp(word, rhs.word) < 0;}     bool operator!= (const WordCount &rhs) const {return strcmp(word, rhs.word) != 0;}     WordCount():lines(NULL), count(0), size(0) {word = new char[1]; word[0] = '\0';}     friend ostream& operator<<...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT