Week 4 Objectives


At the end of this week's classes you should

KNOW:

BE ABLE TO:

Sample Quiz Questions:

  1. Create a makefile for a program that has two header files (board.h and useful.h), and three source files (board.c, useful.c, and game.c). The source files contain these include directives:

    board.c:   #include "board.h"
               #include "useful.h"
    
    
    useful.c:  #include "useful.h"
    
    
    game.c:    #include "board.h"
               #include "useful.h"
    
    (Hint: draw a dependency diagram first)

  2. Write a function that will capitalize all the vowels in a string. Here are the pre- and post-conditions for the function, and the function heading:
    PRE:  string1 is a string.  string2 points to an array with length >= strlen(string1)
    POST: string2 is a string identical to string1, except that all vowels
          in string1 have been converted to capital letters in string2
    
          void bigVowels (const char *string1, char *string2)
    
    Use pointers to solve this problem (don't use array subscripts). You may use the function toupper() (from ctype.h).

  3. Assume that variable ptr is of type char *, and arrays s1[100] and s2[100] are of type char. Write a C statement that will assign ptr the location of the first occurrence of the string s2 in s1.

  4. Using the struct book example from today's handout, define an array called library that can contain information for as many as 1000 books. Assume the array has been filled in with information. Write a statement that will determine the number of characters in the author's name for the book at location 5 in the array.