Home>Article>Backend Development> What does undeclared identifier mean in C language?
"undeclared identifier" refers to "undeclared identifier", which is an error message in C language; usually the variable or function used is not defined, or the definition is inconsistent with the calling time. of.
The operating environment of this article: windows7 system, Dell G3 computer, C11.
"undeclared identifier" means "undeclared identifier". It is an error message in C language, indicating that the identifier is not declared, that is, no declared variables, functions, and types are in use.
The cause and solution of undeclared identifier:
The undeclared identifier is mainly caused by the lack of definition and description when using variables. In fact, the compiler does not recognize this identifier.
When programming in C language, if you want to call library functions, you need to include the corresponding header files, such as sin(), cos(), and other mathematical functions. Their header files are math.h. When calling the sin() or cos() function, you need to add #include
Note: In addition to the type of error prompts such as undeclared identifier, C language also has many professional error prompt languages. The problems and solutions targeted by each error reporting language require guidance based on professional knowledge.
Extended information:
C language is a process-oriented, abstract general-purpose programming language. It is widely used in low-level development and can be compiled in a simple way. , dealing with low-level memory.
C language is a process-oriented computer programming language, which is different from object-oriented programming languages such as C and Java.
C language describes problems faster than assembly language, has less workload, good readability, and is easy to debug, modify and transplant, while the code quality is equivalent to assembly language.
Identifier: In programming languages, identifiers are names used by users when programming. Variables, constants, functions, and statement blocks all have names. It is a symbol used to identify an entity and is used to name variable names, function names, labels and other user-defined objects.
C Identifier is the name used to identify a variable, function, or any other user-defined item. An identifier starts with the letters A-Z or a-z or the underscore _, followed by zero or more letters, underscores, and numbers (0-9).
Naming specifications for identifiers in C language:
1. Identifiers consist of letters, numbers, and underscores, and the first letter cannot be a number. (Punctuation characters, such as @, $ and %, are not allowed in C identifiers.)
2. Identifiers are case-sensitive, that is, they are strictly case-sensitive. Generally use lowercase for variable names and uppercase for symbolic constants. (Note: Letters in C language are case-sensitive, so score, Score, and SCORE represent three different identifiers respectively)
3. C keywords cannot be used as user identifiers, for example: if, for, while, etc. (Note: The identifier cannot be the same as a C language keyword, nor can it have the same name as a user-defined function or C language library function. For is OK because it is case-sensitive.) C language keywords (32 5 7)
4. The length of the identifier is determined by the compilation system on the machine. The general limit is 8 characters. (Note: The 8-character length limit is the C89 standard. The C99 standard has expanded the length. In fact, most industrial standards longer).
5. Identifier naming should be such that "the meaning is known by the name", for example, length (foreign language: length), sum, total (foreign language: sum), pi (foreign language: pi)
For more programming-related knowledge, please visit:Programming Teaching! !
The above is the detailed content of What does undeclared identifier mean in C language?. For more information, please follow other related articles on the PHP Chinese website!