Question
C Programming In this lab, this program will print each command-line argument in its original form, uppercase form, and lowercase form. For example, if you
C Programming
In this lab, this program will print each command-line argument in its original form, uppercase form, and lowercase form. For example, if you run:
./computer Science world
It should print:
[./computer]->[./COMPUTER] [./computer]
[Science]->[SCIENCE] [science]
[world]->[WORLD] [world]
Please note that it should also be possible to run your program without providing any command-line arguments. For example, if you run:
./Computer
[./Computer] -> [./COMPUTER] [./computer]
What to do!
The main() function is already given to you in below c file and do not modify it!
The function invokes two functions, defined in \#ifndef_ARGMANIP_H_ \#define_ARGMANIP_H_ Char **manipulate_args(int argc, const char *const *argv, int (*const manip)(int)); void free_copied_args(char **args,...); \#endif Your task is to create a file named and implement these two functions in it. Your task is to create a file named and implement these two functions in it. The function takes three arguments: - and are the same as the command-line arguments. - is a pointer to a function that manipulates a character, such as and In this function, you will make a "copy" of the argument list. First, you will call once for the overall array in which each element is a string of type Then, you will call for each element of that array, each of which will hold the manipulated version of each argument. Of course, you will have to copy each string character-by-character, passing through the function as you go. For the purpose of this lab, you must use to allocate memory, and you are not allowed to use The return value should have exactly the same format as (see Section 5.10 of The C Programming Language, 2nd Edition). The function takes a variable number of arguments, each of which is a "copied" argument list returned by . The last argument passed to must be See its invocation in the function for the usage. For each argument list passed to , you must everything that you have ed. First, you need to all individual strings. Then, you need to the overall array. Please note that since this is a variadic function, you cannot make any assumptions about the number of argument lists passed to . The autograder may test your implementation by calling in programs other than
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started