Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions