Every variable has a name and a value. The name identifies the variable, the value stores data. There is a limitation on what these names can be. Every variable name in C must start with a letter, the rest of the name can consist of letters, numbers and underscore characters. C recognises upper and lower case characters as being different. Finally, you cannot use any of C's keywords like main, while, switch etc as variable names.
Examples of legal variable names include
x result outfile bestyet x1 x2 out_file best_yet power impetus gamma hi_score
It is conventional to avoid the use of capital letters in variable names. These are used for names of constants. Some old implementations of C only use the first 8 characters of a variable name. Most modern ones don't apply this limit though.
The rules governing variable names also apply to the names of functions. We shall meet functions later on in the course.
Go to Variables Go to Index Go to Global Variables