PLEASE NOTE: the upgrades to this server, secure.csse.uwa.edu.au, have not yet been completed.
Hopefully the changes will be completed on THURSDAY 8th December.
Web-based programs, such as csmarks, cssubmit, and the help fora, will be unavailable at some time on Thursday 8th.
  It's UWAweek 49

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

Displaying selected article
Showing 1 of 919 articles.
Currently 1 other person reading this forum.


 UWA week 31 (2nd semester, week 2) ↓
SVG not supported

Login to reply

👍?
helpful
12:59am Thu 4th Aug, ANONYMOUS
✅ content verified by our teaching staff  

You don't have to modify the code to accept multiple arguments in the sense that argvalue already contains all the arguments passed to the program. You can see this with the following program:

// This program prints out all the arguments passed to it on separate lines.
#include <stdio.h>
int main(int argcount, char *argvalue[]) {
  for (int i = 0; i < argcount; i++) {
    printf("%s\n", argvalue[i]);
  }
  return 0;
}

However, as you noted in 2), you do have to remove the if statement previously used to ensure that only one argument is given since you now want to allow the program to accept multiple arguments.

As you mentioned in 3), you then loop through argvalue to process each argument and have an inner loop to go through each letter in argvalue[i].

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  1:17AM Sep 14 2022
Privacy policy