(Computer Science 2211a) ASSIGNMENT 3




5/5 - (2 votes)

Software Tools and Systems Programming
(Computer Science 2211a)

Assignment overview
The purpose of this assignment is to provide the student with experience with pointers and variable
addresses in memory.
For this assignment, create a new directory under the assignments directory created in the first
assignment. Label this new directory: asn3
Copy the supplied main.c file to the asn3 directory.
All work should be performed in this directory. Use a UNIX editor like vi to create and compile
the C code.
The code MUST compile in the UNIX environment to be considered correct.
Again, this assignment will be contained within a single main.c program.
This program will perform a set of operations on scalar and aggregate variables.
As this assignment is due in the middle of the semester and many students have midterms and papers due,
it has been intentionally set as a lighter assignment. The learning outcome of providing insight and
practice utilizing computer memory manipulation through address required for the assignment is still
A main.c file has been provided that contains six parts dealing with pointers. Imbedded in the code are
places that the student is to complete.
These are indicated by the symbol: X-XXX-X.
The student is to go through the code and change all the X-XXX-X to the correct code.
Some are single variable usage and others are complete set of C statements.
A copy of the completed executable is also provided so the student can inspect the exact expected output.
The X-XXX-X is to be replaced so the output matches exactly (except for the actual address which will
vary from computer to computer and sometimes from one run to the next).
The student is not to use explicit array indexes in any of the substitutions. This means that the replaced
variables must all have a reference use (& or * or both).
Example of disallowed code:
source_arr[i] = i5;
because, even though this works there is no pointer mechanism used.
note: arithmetic operations on a pointer variable is allowed.
int *pVariable;

pVariable = pVariable + 3;
is an operation on a pointer variable and uses the reference (address) in the statement.
The code is to run all six parts, exactly as seen in the supplied executable.
It is recommended you comment out what ever parts you are not working on (or contain required variable
declarations) and work on one part at a time.
Any questions or ambiguities are to be asked through the Forums only. Any individual emails containing
questions on this assignment will be replied to with a request to restate the question in the Forums in Owl
where they will be addressed.
Required Coding Standards
All code is to be indented correctly.
Comments at the very beginning (top – first lines) of each of the C code files must be:
/* CS2211a 2021 */
/* Assignment 03 */
/* your name */
/* your student number */
/* your UWO User Name */
/* Date Completed */
Your program is to be submitted as C code file.
Your script will be a script file created in UNIX.
Replace the professor’s name (MAGGUILLI) with your full name (first name and last name) in both lines
of code where the name MAGGUILLI is found.
All variables MUST have a comment describing their intended use(s) demonstrating an understanding of
what each variable is used for.
A comment describing the code for each major part of the code is already included. Comment(s) can be
added to describe any complete statements you create. They can be brief but must convey what that
section of code performs.
ALSO – very important standard!
You are NOT to use the code
anywhere in your code (except if you have a switch statement in your code).
This is bad coding practice and leads to ‘spaghetti code’ (with apologies to my Italian heritage…) where
program execution control can go any which where.
We do not want to get into the habit of using these constructs. All the code can be written in a fluid
manner without terminating the processes with a break or continue.
Working in UNIX.
Save this file and name it: yourUserName_asn3.c
(see the end of this document for a detailed explanation of yourUserName).
NEXT: Follow the steps below to complete Part 2.
1. Type the following to begin recording your session in a file called yourUserName_asn3.output
script YourUserName_asn3.output
note – (using your actual user name).
2. Display the current date and time using the appropriate command
3. Display your username using the appropriate command
4. Display the contents of the current working directory using the ‘l’ switch (lower case L).
5. Display the contents of the file yourUserName_asn3.c (i.e. show the C program)
6. Compile the program again ensuring the executable is labeled: asn3
7. Run the program.
8. Type exit to stop your screen capture session.
9. Compress the listed required submission files into a single .tar.gz file.
(Ensure have a complete of the Asn3_SubmissionForm in your asn3 directory.)
Asn3_SubmissionForm.txt (or .pdf)
10. Copy (i.e. using an FTP or any method of your choice) the .tar.gz file to your computer so you can
upload it through OWL for submission.
Submission Instructions:
Complete the CS2211 Assignment Submission Form Name (or rename) that form to
Asn3_SubmissionForm.txt (or Asn3_SubmissionForm.pdf)
Save this form in your asn3 directory as a text file or as PDF (most word processors have this
Submit via the CS2211 OWL Web Site the files in your asn3 directory using the instructions on how to
compress and submit the single compressed .tar.gz file.
Submit via the CS2211 OWL Web Site the following three files inside your compressed submission file:
Asn3_SubmissionForm.txt (or .pdf)
note: do NOT include your executable file: asn3
note: you are submitting one tar file (and only one file).
this is a compressed file that contains the files listed above.
do NOT send any of the three above files separately.
note: If you have elected to use an SRA – it must be denoted in the Asn3_SubmissionForm or the SRA
will not be applied.
note: marks will deducted if the Asn3_SubmissionForm is omitted.
It is the student’s responsibility to ensure the work was submitted and posted in OWL.
OWL replies with a summation verification email (every time).
Submission date and time is based on the last file submitted. So if you re-submit after the due
date, the entire assignment will be graded as late based on that timestamp.
The teaching assistant grading your assignment will compile and run your program.
If the program does not compile under UNIX, the TA will NOT attempt to correct or fix
your program so it will run.

(yourUserName – example: assume my UWO email is [email protected]
i.e. if my email is – [email protected] then my user name will be – kdoit373
So, my UWO User Name is: kdoit373 and this assignment is asn1
therefore, one of the file names that is to be used for submission is:
It is the student’s responsibility to ensure the work was submitted and posted in OWL.
OWL replies with a summation verification email (every time).
Any assignment not submitted correctly will not be graded.
PS: remember: do your own work – you will need to know all this for the exam to pass !!!!
Please check CS2211 Assignment Submission Guidelines.
note: Guidelines mention the example for assignment 1 – please substitute a 3 for the 1.