Home
31.
What are the practical differences between symbolic constants created with the #define directive and those created with the const keyword?

The differences have to do with pointers and variable scope. Pointers and variable scope are two very important aspects of C programming.

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

An integer variable can hold a whole number (a number without a fractional part), and a floating-point variable can hold a real number (a number with a fractional part).

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

A type double variable has a greater range than type float (it can hold larger and smaller values). A type double variable also is more precise than type float.

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

a. The size of a char is one byte.
b. The size of a short is less than or equal to the size of an int.
c. The size of an int is less than or equal to the size of a long.
d. The size of an unsigned is equal to the size of an int.
e. The size of a float is less than or equal to the size of a double.

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

The names of symbolic constants make your source code easier to read. They also make it much easier to change the constant's value.

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

a. #define MAXIMUM 100
b. const int MAXIMUM = 100;

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

Names of variables and constants should describe the data being stored. Variable names should be in lowercase, and constant names should be in uppercase.

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

Symbolic constants are symbols that represent literal constants.

39.
What’s the minimum value that a type int variable can hold?

If it's an unsigned int that is 2 bytes long, the minimum value it can hold is 0. If it is signed, –32,768 is the minimum.

40.
What characters are allowed in C variable names?

Letters, numerals, and underscores.