It's UWAweek 48

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 the 2 articles in this topic
Showing 2 of 919 articles.
Currently 5 other people reading this forum.


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

Login to reply

👍?
helpful
5:42pm Wed 3rd Aug, ANONYMOUS

unsure with how to go about this. Have come from a java standpoint, and understand that to complete this, id need to somehow: 1) firstly modify code to accept multiple arguments passed as parameters - zero clue here, or if i even need too 2) change the if argcount != 2 statement 3) and introduce another outer loop to iterate through the argvalue[j][i] instead of argvalue [1][i] any help would be much appreciated, am new to this language and its specifications are quite backwards and confusing. Cheers


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