Back
CS 456 Home

Assignment h1: Basic C Programming

Due Date: Feb 6 at 8AM EST

This assignment is just a basic review of programming in C. As we will be doing most of our 
programming in this class using C, we do need to make sure that we have the basics down. 

You will be working on a few basic programs, as most of you are already somewhat familiar with C. 
I've linked a couple of tutorials on C over in "Links" on the left sidebar if you'd like a 
refresher. 

You will be doing the following programs:

1. reversecmd.c - printing the command line arguments in reverse order, one per line.

2. sequence.c - a simplified version of the seq command in Linux, where you give two numbers via  
		the command line and it prints every number from the first number to the second 
		number.

3. head_simple.c - a simplified version of the head command, where given a filename via the command
                   line, it will print the first 10 lines of a file if no number is specified, or if
		   a number is specified, print that number of lines in the file.

There already is some code in each of these source files. Use that existing code and the comments to
help you finish the program. You can also look at the examples in the jan28 directory of the 
In-Class Code to help you. I ask that you not depend on Generative AI (like ChatGPT, etc) to do 
this assignment. You should be able to do this assignment based on the examples given in the book 
and in the In-class code.

To pick up this assignment, copy the h1 folder into your cs456 directory by running: 
		     cp -R /home/cs456/h1/ ~/cs456/
		OR:  hw_get.py cs456 h1

Then use a text editor (like vi, nano, emacs) to open it and follow the instructions inside that file.

Once finished, leave it in that directory. I will run a script to collect the files when the due 
date approaches.