Exercises : Answer the following Question

Submitted by Anonymous (not verified) on Sun, 03/10/2013 - 21:00

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson. The answers and hints to the questions and exercises are given in Appendix E, "Answers to Quiz Questions and Exercises."
Quiz

    What are the values represented by the following enum names?

    enum months { Jan, Feb, Mar, Apr,
                  May, Jun, Jul, Aug,
                  Sep, Oct, Nov, Dec };

    What are the values represented by the following enum names?

    enum tag { name1,
               name2 = 10,
               name3,
               name4 };

    Which statements in the following are equivalent in the variable declaration?
        typedef long int BYTE32; BYTE32 x, y, z;
        typedef char *STRING[16]; STRING str1, str2, str3;
        long int x, y, z;
        char *str1[16], *str2[16], *str3[16];
    Can you pass some command-line arguments to a main() function that has the following definition?

    int main(void)
    {
       . . .
    }

Exercises

    Write a program to print out the values represented by the enumerated names declared in Quiz question 2.
    Given the following declarations:

    typedef char WORD;
    typedef int SHORT;
    typedef long LONG;
    typedef float FLOAT;
    typedef double DFLOAT;

    write a program to measure the sizes of the synonyms to the data types.

    Rewrite the program in Listing 18.4. This time, add integers starting at the value of MIN_NUM instead of the value of MAX_NUM.
    Write a program that accepts command-line arguments. If the number of command-line arguments, not including the name of the executable itself, is less than two, print out the usage format of the program and ask the user to reenter the command-line arguments. Otherwise, display all command-line arguments entered by the user.

Related Items

The Dereference Operator (*)

The Dereference Operator (*)

Declaring Pointers

Declaring Pointers

What Is a Pointer?

What Is a Pointer?

A pointer is a variable whose value is used to point to another variable.

Exercises : Answer the following Question

To help solidify your understanding of this hour's lesson, you are encouraged to answer the quiz questions and finish the exercises provided in the Workshop before you move to the next lesson.

Question and Answer

Question and Answer

    Q How many expressions are there in the if statement?