IOS Study Notes: (2) c language-2.3 identifier
1. What is an identifier is some of the symbols and names customized in the program. To distinguish it from keywords: keywords are the default symbols provided by C language, and identifiers are customized by programmers. identifier 1) identifier, literally used to identify something, the purpose of the identifier is to distinguish these things 2) Actually, identifiers serve almost the same purpose as human names. To distinguish each person, a name is given at the time of birth. 3) C language is composed of functions, a c program may have multiple functions. to distinguish these functions, each function is given a name. The function name is a type of identifier. In addition to functions, we will also learn the concept of "variables" in the future. The variable name is also the identifier 3. Naming 1> naming rules (must comply )? It can only contain 26 English letters, 10 Arabic numerals, 0 ~ 9. What are the underscores? Strictly case sensitive. For example, test and Test are two different identifiers? Cannot begin with a number? Cannot Use keywords as identifiers 2> naming conventions (best practice )? Try to create a meaningful name, for example, a complete English word. When someone else looks at the name, the identifier can be used. If you do not understand English, you can also use Pinyin. Do not use meaningless names such as abcde and sfsdfsdf? If the identifier contains multiple words, you can use the camper mark (except for the first word, the first letter of each word is capitalized): firstName, myFirstName, or underscore _ to connect: first_name, my_first_name4. common identifiers naming errors legal identifiers illegal identifiers annotation fromNo12from #12 identifiers cannot use # symbol my_Booleanmy-Boolean identifiers do not use the '-' symbol, the underscore "_" should be used to replace Obj22ndObj. The identifier cannot start with a number. myIntint "int" is the built-in keyword jack_rosejack & rose symbol "&" cannot appear in the identifier GUIG. u. I identifier must contain ". "separator 5. exercise points out that the identifier is correct test1 Mike2jack My_tExt _ testtest! 32 haha (da) tt haha _ text 123 haha 78 text a _ 123 _