Question: (a) Describe what are the two input parameters argc and argv to the main function. [3 marks] (b) i) Create a small program in C

 (a) Describe what are the two input parameters argc and argv

(a) Describe what are the two input parameters argc and argv to the main function. [3 marks] (b) i) Create a small program in C showing how you would sequentially process each input given to your C-program at the command line. For each input coming from the command-line, show how you would pass it to a subfunction called processInput() being called to processes each input from the command line. The subfunction processInput() should just take the input argument and the index and print them both to the screen, and then return to the calling environment. Include a short main that calls processInput() for each input parameter given by the user at the command line. Save your program to the file: lastName_firstName_EEEE 1042Final_2b.c and submit it together with your exam. For full marks you must adequately comment your code. [9 marks] ii) Write a second version of the function processInput2() that instead of printing the string, prints the string in reverse. For example if the input is "abcdef" the function prints "fedcba". Setup your program such that it can be switched between the original processInput() and the new processInput2() at the calling line in main to easily switch between testing of the two functions you've created. [8 marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!