Assignment 0
CS/ECE 354, Fall 2009
Send e-mail questions to Karen,
smoler@cs.wisc.edu
or to ?, ?@cs.wisc.edu.
This optional assignment has no due date.
However, complete it before Monday Sept. 14, to give yourself
enough time to work on Assignment 1.
Purpose
This assignment is intended to give experience using a Unix
operating system.
Knowing how to work within a Unix environment is a valuable skill,
and one that is likely to be needed in further CS classes.
Please do not assume that you will get by in this class doing
assignments using a Windows system, copying as necessary to
turn in assignments.
Statement
All work for this assignment is to be done on one of the
department's instructional Unix machines.
This assignment requires you to use several different software
tools, including a C compiler, web browser, and an editor,
to obtain answers that are placed in a file.
Do the following 3 items:
-
We have written a little C program for you. You need to
copy the program,
compile the program,
modify the program (to fix the error),
and then recompile and run the program.
Make note of the compiler's output as well as the corrected program's output.
The program source code is in the file
/p/course/cs354-common/public/bin/a0.c
(C language source code programs end with the suffix
.c by convention.)
- Copy the file to your own directory.
You will want to understand the directory structure,
and make a new directory for 354 programs within your
private
directory.
- Compile the copied file (a C program).
For information about how to compile, read further under
Notes below.
On purpose (to require you to edit the file!),
this program contains an error.
Make note of the compiler error you receive.
Then, use an editor to correct the program.
Compile the corrected program,
and then run the program,
making note of the program's output.
-
Almost everything you need to know about CS/ECE 354 is posted on the
course web page.
You need to run a web browser, find the course home page,
(Note: you've already done this, to find this assignment!)
and make note of the TA names and office hours.
-
Look at the questions given in the file
/p/course/cs354-common/public/html/homeworks/a0.questions
Record your answers to these questions in a file (using an editor).
Once you have done these 3 things,
use an editor (again, because learning to use a Unix editor will be
key to efficiently completing assignments)
to add the following information to your file
containing the answers to the questions.
Add the C program's compiler error, the C program's
corrected output, and the
TA names and office hours.
Also, place your name, section number, and student ID
at the beginning of the file.
This file is the end result of the assignment.
It is what would have been turned in for this assignment.
Notes
-
To compile a C program, use a C compiler.
cc is fine for this assignment.
If the name of the C source code program were
myprogram.c, then the
Unix command
cc myprogram.c
will compile this program, placing the executable program
in the file a.out.
Note that this command (given in this manner)
must be executed while your current working directory
(often abbreviated cwd) is the one
containing the C source code file.
To place the executable in a file other than a.out,
add another option and argument to the command line:
cc myprogram.c -o executablename
-
To run a program (any program!), use the name of the program
as the Unix command.
For example, if you compiled with the command
cc myprogram.c
(and there were no compiler errors), then
the executable is in a file named a.out.
To execute the program, a.out becomes the
Unix command.
-
At various times while working on this assignment,
you will need to use an editor. You may use any editor you
like. Common choices are
emacs,
vim or gvim, and
pico.
Handing In the Assignment
We will be using the CSL-supported handin script to turn
in assignments online.
This optional assignment will not be turned in.