All work for this assignment is to be done on one of the department's instructional Unix (Linux) machines. You are welcome to remotely log in using your own SW package (SecureCRT, ssh, putty, etc.), but you will have to figure out those details on your own. It is not that hard really.
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.
Read the Lab Tutorial in the online book Operating Systems: Three Easy Pieces by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau. It has some useful tips for programming in the C environment.
In particular, there are two tools you need to become quite familiar with.
The first is a shell.
The shell is where you type commands;
getting efficient at doing so
(and in particular, learning all of the keyboard shortcuts, etc.)
makes you more wizard-like.
Spend the time and read the documentation!
You can type
man bash
to learn more about the bash shell, for example;
it is a long but worthwhile read!
And while many people use the bash shell,
others use tcsh (like me) or zsh or even more exotic ones.
Pick one you like, learn how to use it well,
customize it to make yourself more efficient,
and in general spend the time to get better at it!
The second tool of note is your text editor. Becoming efficient within a particular text editor means spending a lot of time with it, learning all of the keyboard shortcuts, and in general being able to type in and move around code quickly. Many use emacs, and others use vim (like me), a variant of another old editor known as vi. Neophytes use tools like gedit, which perhaps is not a bad way to begin, but really not powerful enough to get the job done in your career; even if you start here, you'll need to eventually move to something better. There are some platform-specific rather cool editors out there, for example, TextMate for the Mac. You might feel like checking something like that out too.
Here are some useful tutorials. Do note that it takes a long time of simply using and learning about any of these tools to become proficient. Start spending the time now!
For this assignment, do the following:
/p/course/cs354-common/public/bin/a0.c
.c
by convention.)
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.
/p/course/cs354-common/public/html/homeworks/a0.questions
gcc
for this assignment.
If the name of the C source code program were
myprogram.c
, then the
Unix(Linux) command
gcc myprogram.c
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:
gcc myprogram.c -o executablename
gcc myprogram.c -o executablename -Wall -m32 -O
gcc myprogram.c -o executablename
executablename
and the command line will be
executablename
./executablename
To turn in the assignment, copy the file "a0.questions" with your answers to the handin directory.
shell% cp a0.questions /p/course/cs354-common/public/fall15.handin/<yourloginID>/p0/