[Study Notes] [C Language] notes and Study Notes notes

Source: Internet
Author: User

[Study Notes] [C Language] notes and Study Notes notes
1. What is annotation?

1) annotation is a very important concept in all computer languages. Literally, it refers to the meaning of annotation and interpretation.

2) annotations can be used to explain the meaning of a program or a line of code to facilitate communication between programmers. If I add the corresponding comments after writing a line of code, then when someone else sees this comment, they will know what the code is.

3) Comments can be any text, that is, Chinese characters can be written.

4) in development tools, the comment is generally bean paste green

2. Single Row comment

1) A single line comment starts with two forward slashes, and starts with //. Only one line can be commented. From // to the end of this line, all comments are comments.

2) Comments can be written anywhere: Outside the function, inside it, after each statement

3. Multi-line comment

Multi-line comments start with/* and end with */. The content in the middle of/* and */is both comments.

4. Functions of annotations

1> the annotated code does not participate in compilation.

* Annotations are intended for users rather than computers. How Can computers view the Chinese we write. Therefore, when the program is compiled, the comments are not compiled into the. o target file.

* The size of the. o file shows that the annotated code is not compiled.

2> check the function of the Code

3> troubleshooting

5. annotation nesting

1) single-row comments can be nested with single-row comments and multi-row comments

// Single Row 1 // Single Row 2

// /* dssf */  // dssfblog

2) multi-line comments can be nested with single-line comments

/*   
// This is a comment
// This is still a comment
All of these are annotations.
*/

3) multi-line comments cannot be nested with multi-line comments

/* 12345
/* Fight tigers in the mountains */
The tiger is not at home */

4) The following statements are incorrect.

// /*  
This is not commented out. It should be/*/commented out.
*/
 
6. Importance of annotations
L. develop a good habit of writing comments. The first thing for most project managers to check their subordinate codes is to see if they have written comments. Many companies also try to check comments. (A computer test is to give you a programming question and a computer, solve the problem within the specified time)
2. Today, you have written several hundred lines of code. I'm glad that you have made a very good function. However, you forgot to write comments. After a week, you may not be able to understand the code. This is a normal task. If you write comments, the situation will be different. Comments can help you review the role of the Code.
3. You have been in a company for more than one year and have written tens of thousands of lines of code, but you do not need to write any comments. One day, when you leave your job and a new employee takes over your project, he must first understand the code you wrote. However, you did not write any comments at all. The 0.1 million lines of code are all in English, which makes this new employee very painful. Everyone has their own ideas. The idea of writing code is definitely different. It is very painful to read the code written by others, especially the code without comments. If you do not write comments, the company's development efficiency will be greatly reduced. Therefore, all formal companies place great importance on annotations.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.