Homework 6
Purpose:
C programming experiments.
Use a C book. If this is your first contact with C, give the book a
quick read (no longer than 2 hours).
1. Write a program that multiplies two integers passed as arguments.
2. Compile and run the program. Use gcc as a compiler. Try to
identify
the two steps described in the course: source to objects to
binaries.
3. Modify your program to read the two integer from the standard
input. Compile it and try it.
4. Experiment by passing random characters or extremely large
integers to your program, see how it behaves.
5. Modify your program to check the input and exit if it doesn't
find
the right type of value. (You should always do that for real
programs)
6. Modify your program to read the input from a file.
7. Combine the versions you generated: look for arguments, if no
arguments look for values from a file, if no valid values prompt at
standard input, if no valid input print an usage message and exit.