The rules are: 1. The first character of the identifier must be a letter (a~z or A~Z) or an underscore (_); 2. The following characters must be any letters, underscores (_ ), composed of numbers; 3. The uppercase and lowercase letters in the identifier are different and represent different meanings; 4. The identifier cannot be a keyword.
The rules for judging legal identifiers in c language are as follows:
(1) The first character must be a letter ( Case-insensitive) or underscore (_);
(2) followed by letters (case-insensitive), underscore (_) or numbers;
(3) in the identifier There is a difference between uppercase and lowercase letters. For example, the variables Sum, sUm, and suM represent three different variables;
(4) cannot have the same name as a special-purpose reserved identifier (ie, keyword) that has been predefined by the c compilation system. For example, identifiers cannot be named float, auto, break, case, this, try, for, while, int, char, short, unsigned, etc.
knowledge expansion
All keywords in C language:
auto
enum
restrict
unsigned
break
extern
return
void
case
float
short
volatile
char
for
signed
while
const
goto
sizeof
_Bool
continue
if
static
_Complex
default
inline
struct
_Imaginary
do
int
switch
double
long
typedef
else
register
union
Recommended tutorial: "C Language"
The above is the detailed content of What are the rules for determining legal identifiers in C language?. For more information, please follow other related articles on the PHP Chinese website!