Sams Teach Yourself C in 21 Days

(singke) #1
printf(“*”);
}
}


  1. Write a function that verifies that a character is a vowel.

  2. Write a function that returns 0 if it receives a character that isn’t a letter of the
    alphabet, 1 if it is an uppercase letter, and 2 if it is a lowercase letter. Keep the
    function as portable as possible.
    4.ON YOUR OWN:Understand your compiler. Determine what flags must be set to
    ignore variable case, allow for byte alignment, and guarantee ANSI compatibility.

  3. Is the following code portable?
    void list_a_file( char *file_name )
    {
    system(“TYPE “ file_name );
    }

  4. Is the following code portable?
    int to_upper( int x )
    {
    if( x >= ‘a’ && x <= ‘z’ )
    {
    toupper( x );
    }
    return( x );
    }


822 Appendix D

47 448201x-APP D 8/13/02 11:17 AM Page 822

Free download pdf