Fortune Telling Collection - Comprehensive fortune-telling - How to use comma expressions
How to use comma expressions
Key points of comma expression:
The operation process of 1. comma expression is to calculate the expressions one by one from left to right.
2. Comma expression as a whole, its value is the value of the last expression (that is, expression n).
3. Comma operator has the lowest priority among all operators.
In the code, %d, as a format declaration part, has controlled that the output value can only be a decimal number, so its output value is the result of rounding down the actual value. X= 10, y=3, and the value of z should be 10/3, which is 3.3333 ... but because of the flow control, the output result can only be 3.
In addition to the integer limit, the \n in the code is a line break for ordinary characters, indicating that control moves to the beginning of the next line after output.
Extended data
The advantages of C language are as follows:
1. Concise, compact, flexible and convenient.
C language has only 32 keywords and 9 control statements. The writing form of the program is free and case-sensitive. Combine the basic structure and sentences of high-level language with the practicality of low-level language. C language can manipulate bits, bytes and addresses like assembly language, which are the most basic working units of a computer.
2. Rich operators.
Operators in C language cover a wide range, including 34 operators. C language regards parentheses, assignment and cast as operators. Therefore, C language has extremely rich operation types and diverse expression types. Flexible use of various operators can achieve operations that are difficult to achieve in other high-level languages.
3. Rich data types.
The data types of C language are: integer, real number, character, array, pointer, structure, shared body and so on. Can be used to realize the operation of various complex data structures. The concept of pointer is introduced to improve the efficiency of the program.
4. The expression is flexible and practical.
C language provides a variety of operators and methods to represent values, and the expression of problems can be obtained in many ways, so its programming is more active and flexible. Its grammatical restrictions are not strict, and its programming freedom is great. For example, it can be used for integer data, character data and logical data.
5. Allow direct access to physical addresses to operate hardware.
Because C language allows direct access to physical addresses and direct operation of hardware, it has both the functions of high-level language and many functions of low-level language, and can operate on bits, bytes and addresses like assembly language. These are the most basic working units of computers and can be used to write system software.
6. The generated object code has high quality and high program execution efficiency.
C language is faster than assembly language in describing problems, less workload, good readability, easy debugging, modification and transplantation, and the code quality is equivalent to that of assembly language. Generally speaking, C language is only less efficient than the object code generated by assembler 10% ~ 20%.
7. Good portability.
86% of C compilers of C language on different machines are common, so C compilers are easy to transplant. A program written in C language in one environment can be transplanted to another completely different environment without any changes or slight changes.
8. Strong expression.
C language has rich data structures and operators. Including integer, array type, pointer type, union type and other data structures, to achieve the operation of various data structures. There are 34 kinds of operators in C language, with a wide range. Flexible use of various operators can achieve extremely difficult operations.
Baidu Encyclopedia-Comma Expression
Baidu encyclopedia -c language
- Related articles
- The end of the old farmer Chen He.
- What does birthday king mean?
- Who knows the funeral customs of Huayao Yi people?
- What does it mean to dream of going home for the New Year? What's the special meaning?
- Folk sketch fortune-telling _ fortune-telling sketch
- What does a Libra dog wear?
- Dilraba and Yang Yang's TV series.
- How many villages are there in Taigu County? What's your name?
- Excuse me, the fortune teller said: What does it mean to be weak with children? Thank you!
- Check a woman's marriage fortune _ check a woman's marriage fortune-telling?