When doing these exercises in class, please be sure to keep the output of each step to show the instructor at the end. I need to check off progress/completion each day, or get evidence of the completed exercise by end of day.
Part 1: C-Strings
strcmpissue with “alligator” and “Zebra” described in the C-Strings video lecture. Take note of which string is “greater”.
strcmpcall in the comparisons function to
strcasecmp. Recompile and run to see how the output changes.
Part 2: Pointer/Array equivalence
In many cases C programmers will use pointers and arrays interchangeably (but not always! King Chapter 13 lists some gotchas). To see an example where this works, do the following:
copyare passed as arrays. Also note the use of the
EOF(end-of-file) character. This is automatically added when we save files, but requires special input when typing at the keyboard. At the beginning of a line, hold down the Control key and hit D. This is usually written <Ctrl-D>. Note the output.