Goals for this Warmup

  • Practice programming with strings, structs, and pointers
  • Learn to implement and test programs with command-line arguments

For this lab, you are welcome to get technical help from another student on how to use or install any of the tools involved. You may also get syntax help on C. You may not, however, get help on the algorithmic portion of the exercise outside of office hours or piazza questions to TAs or instructors.

Set up

You should already have your completed pre-lab files and a hw4 directory.

Problems:

During this warmup, you are going to implement the functions that exercise strings, structs and pointers for which you wrote skeletons in the pre-lab. If you are using Duet Programming, do not forget to trade off after each function. The functions are ordered to provide specific practice to each student.

You will implement main and test files differently this time. Instead of listing your test cases in order, make sure you check the first command-line argument (after the executable name) for the test, and the rest of the arguments for the inputs. Your tests need to be in a file named testscript.

touch testscript svn add testscript chmod +x testscript
You need to do chmod +x testscript so that you can execute the file. To execute the tests listed in the file, type "./testscript".

For a given function, the Implementer will implement the code and the Strategist will design test infrastructure and create the tests in the testing script.

Submit

At this point, you should have done the following:
  • Created a folder named hw4 in your repository and run svn add hw4
  • Created , added, and filled in four files: warmup4.h, warmup4.c, testscript and Makefile inside your hw4 directory.
  • If you participated in Duet Programming, make sure copy over the files into your personal repository. The scp command copies files from another's account.
  • Compiled your executable manually and with the Makefile
  • Executed your code to make sure it runs properly and inspected the results.
  • committed your files:
    $ svn commit -m "hw4 warmup complete"
Now you're ready to move on to hw4!! Remember that the homework is completed individually.