- Home
- Interview Questions
- C Programming
The differences have to do with pointers and variable scope. Pointers and variable scope are two very important aspects of C programming.
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).
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.
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.
The names of symbolic constants make your source code easier to read. They also make it much easier to change the constant's value.
a. #define MAXIMUM 100
b. const int MAXIMUM = 100;
Names of variables and constants should describe the data being stored. Variable names should be in lowercase, and constant names should be in uppercase.
Symbolic constants are symbols that represent literal constants.
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.
Letters, numerals, and underscores.