Home >Common Problem >C language cannot find identifier when calling function in main

C language cannot find identifier when calling function in main

(*-*)浩
(*-*)浩Original
2019-12-26 09:38:5033856browse

C language cannot find identifier when calling function in main

Solution to the problem that the identifier cannot be found when calling a function in main in C language:

Just put the defined function before the main function.                                                                                                         The method body of () needs to be written before the main function.

Execution in C language always starts from the main function, no matter where the main function is, it must start from it. If the function you define is after the main function. And if there is no declaration of the calling function before the main function, then the system will not recognize the function called in the main function, and there will be an error message. If the defined function is before the main function, then never mind.

Specifications for the use of identifiers in C language: C language cannot find identifier when calling function in main

1. Identifiers consist of letters (A-Z, a-z), numbers ( 0-9), underscore "_", and the first character cannot be a number, but can be a letter or underscore. For example, correct identifiers: abc, a1, prog_to. 2. C language keywords cannot be used as user identifiers, such as if, for, while, etc.

3. 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).

4. Identifiers are case-sensitive, that is, they are strictly case-sensitive. Generally use lowercase for variable names and uppercase for symbolic constants.

5. Identifier naming should be such that "the meaning is known by the name", for example, length, sum, and total (sum).

The above is the detailed content of C language cannot find identifier when calling function in main. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn