Here are two facts about variable names in C:
- A variable name can contain letters (upper- and lower-case), digits,
and underscores (the `_' character).
- A variable name cannot start with a digit.
There are no restrictions on the length of C variable names. Let's look at
- X is an acceptable variable name.
- x_y is also acceptable.
- x+y is not acceptable, because it contains a plus sign.
- Epsilon is acceptable.
- TheFinalAnswer is acceptable.
- this_is_a_long_variable_name is acceptable.
- things_12 is acceptable.
- 12_things is not acceptable, because it starts with a
Keep in mind that C is case-sensitive. For example, C treats the names
Epsilon and epsilon as two different names.
Eric N. Eide
Department of Computer Science
University of Utah