Program in the world, you can let the computer do a lot of things according to the instructions, such as the numerical calculation, image display, voice dialogue, video playback, astronomical calculation, send mail, game graphics and anything we can imagine. To accomplish these tasks, the program needs to use the data, which is the number and character that hosts the information.
In a computer, the nature and presentation of the data may vary. So it is necessary to classify data of the same nature and describe it with certain data types. Any data is presented to the user in both constant and variable forms. A constant is the amount of a program whose value cannot be changed at run time. Constants do not account for memory, which appears as operands directly in the various registers of the operator when the program is run. A variable is the amount of the value that can be changed while the program is running. The function of a variable is to store data. Example:
#include <stdio.h>
int main ()
{
int year;
year=2014;
printf ("Welcome to www.dotcpp.com! \ n ");
return 0;
}
Where year is a variable of type int, and 2014 is a constant, that is, a number.
The definition of a variable:
The variable name, function name, label, etc. used in the program are collectively called identifiers. Except for the function name of the library function, which is defined by the system, the rest is customized by the user.
c Specifies that an identifier can only be a string of letters (A~Z,A~Z), Numbers (0~9), underscores (_), and that its first character must be a letter or an underscore. and cannot have the same name as the C keyword (see the next section for the keyword).
In addition, the following points must be noted when using identifiers:
(1) Standard C does not limit the length of identifiers, but it is limited by various versions of the C language compilation system, and is also limited by specific machines. For example, the first eight bits of the specified identifier are valid in a version C, and when the first eight bits of the two identifiers are the same, they are considered to be the same identifier.
(2) in identifiers, there is a difference in case capitalization. For example, clang and clang are two different identifiers.
(3) Although identifiers can be arbitrarily defined by programmers, identifiers are symbols used to identify a quantity. Therefore, the naming should have the corresponding meaning, in order to read comprehension, do "as the name implies."
C Language Network
The application of C language constants and variables