17.12 Programming Exercises
Exercise 17-1: Take one of your previous programs and run it using the interactive
debugger to examine several intermediate values.
Exercise 17-2: Write a matrix-multiply function. Create a test program that not only
tests the function, but times it as well. Optimize the program using
pointers and determine the time savings.
Exercise 17-3: Write a program to sum the elements in an array. Optimize it.
Exercise 17-4: Write a program that counts the number of bits in a character array.
Optimize it through the use of register-integer variables. Time it on
several different arrays of different sizes. How much time do you
save?
Exercise 17-5: Write your own version of the library function
memcpy. Optimize it. Most implementations of
memcpy are written in assembly language and take
advantage of all the quirks and tricks of the processor. How does
your memcpy compare to theirs?
|