Homework 5

  1. Read the file /usr/include/string.h and read the man page for every standard routine listed in that file.
    Write a short essay on the subject: string.h is my friend.
  2. Write a program which converts a Roman Numeral to an integer.
  3. Read the man page for malloc and friends. Write a program maximizing stupidity in the use of malloc and free. Compile, run and crash your program. Explain why you crashed.
  4. Write a program similar to the sample program which reads numbers from a file and puts them in an array. However, your array will start out small and double in size each time it is required in order to hold all the input.
    Keep a value a_size which is the current array size.
    Don't forget to copy the old portion of the array into the new array and to free the old array.
    Test your program! Provide with your program your input test files. We will assume that your program "works" only in the sense that it runs your test files correctly. This is generally how Q.C. is done in the real-world.
  5. What is the difference between K&R C, Standard C, ANSI C, and C9x?
  6. What is the One True Brace Style?