asked 215k views
1 vote
This is an INDIVIDUAL assignment. You can (and should) work in groups to research how to do the assignment, but each person should code their own version and make their own submission. This program is to demonstrate the usage of command line arguments in a C program. You will write this to run in the Linux virtual machine. The program should display the number of arguments from the command line and list each one on the console. Here is a sample execution: student:~/CSC415$ make run RUNOPTIONS="Hello, these are overridden options 3 6 9" gcc -c -o bierman_robert_hw1_main.o bierman_robert_hw1_main.c -g -I. gcc -o bierman_robert_hw1_main bierman_robert_hw1_main.o -g -I. ./bierman_robert_hw1_main Hello, these are overridden options 3 6 9 There were 9 arguments on the command line. Argument 00: ./bierman_robert_hw1_main Argument 01: Hello, Argument 02: these Argument 03: are Argument 04: overridden Argument 05: options Argument 06: 3 Argument 07: 6 Argument 08: 9 student:~/CSC415$ You should submit your source code file(s), Makefile along with a short writeup in PDF format into your GIT repository and submit the PDF into the assignment in iLearn. Your write-up should include a description of the project and what you did, issues you had, how you overcame the issues and the compilation and execution output from your program (screen shots embedded in the PDF document. Your execution output should include commands with the command linearumants

asked
User DrBuck
by
7.7k points

1 Answer

1 vote
It looks like you have a programming assignment where you need to create a C program that accepts command line arguments and displays information about those arguments. Here's a step-by-step guide on how to approach this:

1. Create a C source code file (e.g., `main.c`) for your program.

2. Include the necessary header files for your program, such as `` and ``.

3. Write the `main` function where your program will execute.

4. Inside the `main` function, use the `argc` and `argv` parameters to access command line arguments. `argc` is an integer that stores the number of arguments, and `argv` is an array of strings that holds the actual argument values.

5. Display the total number of command line arguments using `argc`.

6. Iterate through the `argv` array to display each argument separately.

7. Compile your program using a `Makefile`. The `Makefile` should have rules for compilation and running the program.

8. Run your program with the provided sample execution command to ensure it works as expected.

9. Take screenshots of your program's execution, including the commands you used.

10. Create a PDF write-up that includes a project description, any issues you encountered and how you resolved them, and the compilation and execution output with embedded screenshots.

11. Finally, submit your source code, `Makefile`, and the PDF write-up to your GIT repository and the assignment in iLearn.

Remember to test your program thoroughly to ensure it meets the requirements of displaying command line arguments correctly. If you encounter any issues, refer to C programming resources or seek assistance from your teacher or classmates.
answered
User EHF Shahab
by
7.4k points

No related questions found