Question
C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM The following program in C-language needs to use argc, argv, and atoi: 1.
C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM C-PROGRAM
The following program in C-language needs to use argc, argv, and atoi:
1. Inside the main(), how would you use argc to determine how many numbers were entered on the command line?
For example: If the user inputs: 9 10 11 12
What should return is that amount of numbers entered from the command line is 4.
* Also, how would use MIN and MAX, so that the program will handle no input or too much input
--------------------------------------------------------------------------------------------------------
2. Inside the same main(), how would you use atoi and argv for a loop that takes each number, which could be written as a string and converts the string into an integer, and stores the integer into an array?
For example: Similar to the previous sequence, if the user input: 9, 10, "11", "12"
The loop should convert the strings "11" and "12" in ints 11 and 12, and store them into an array.
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