# Storing Information: Variables and Constants in C

• Print
This chapter is from the book

## Workshop

The Workshop provides quiz questions to help you solidify your understanding of the material covered and exercises to provide you with experience in using what you've learned.

### Quiz

1. What's the difference between an integer variable and a floating-point variable?

2. Give two reasons for using a double-precision floating-point variable (type double) instead of a single-precision floating-point variable (type float).

3. What are five rules that the you know are always true when allocating size for variables?

4. What are the two advantages of using a symbolic constant instead of a literal constant?

5. Show two methods for defining a symbolic constant named MAXIMUM that has a value of 100.

6. What characters are allowed in C variable names?

7. What guidelines should you follow in creating names for variables and constants?

8. What's the difference between a symbolic and a literal constant?

9. What's the minimum value that a type int variable can hold?

### Exercises

1. In what variable type would you best store the following values?

1. A person's age to the nearest year.

2. A person's weight in pounds.

3. The radius of a circle.

5. The cost of an item.

6. The highest grade on a test (assume it is always 100).

7. The temperature.

8. A person's net worth.

9. The distance to a star in miles.

2. Determine appropriate variable names for the values in exercise 1.

3. Write declarations for the variables in exercise 2.

4. Which of the following variable names are valid?

1. 123variable

2. x

3. total_score

4. Weight_in_#s

5. one

6. gross-cost