C Programming Assignment
Consider the linear search program ~walker/assembly/prog1.p
,
written in Pascal.
-
Translate that program to C, using the same statements as much as possible.
-
Write a second version of the program in C, taking advantage of C's
conditional execution of Boolean statements to eliminate the Done
variable in the search procedure.
Notes:
-
Each program should utilize the same procedure names and parameters as
found in the Pascal program.
-
Be careful that your C programs do not try to access the array outside of
the legal bounds. (While C does not provide array-bounds checking, any
such access could result in an invalid memory reference. Storing data
with an out-of-bounds index changes some memory location -- perhaps related
to your code, your data, or a system function.)
-
Turn in your programs following the format identified in the
C programming lab.
This document is available on the World Wide Web as
http://www.math.grin.edu/~walker/courses/211/C-assign.html
created October 1, 1997
last revised November 14, 1997