IOS Study Notes: (2) C Language -- 2.4 notes

Source: Internet
Author: User

IOS Study Notes: (2) C Language -- 2.4 notes

# Include <stdio. h> // This is a main function. It is the entry of the program. * annotations are generally two main functions of green Annotations: 1. check the role of the Code. 2. troubleshooting */int main () {// This function outputs printf ("abc \ n"); printf ("abc \ n") on the screen "); printf ("cde \ n"); return 0;} 1. what is annotation 1) annotation is a very important concept in all computer languages. Literally, it means 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 this line of code is for. 3) Comments can be any text, that is to say, you can write Chinese. 4) Note in development tools that are generally bean paste green. 2. single line comment 1) a single line comment starts with two forward slashes, that is, it starts with //. Only one line can be commented. From // to the end of this line, the content is commented. 2) comments can be written anywhere: 3. multi-line comment multi-line comment starts with/*, ends with */, and the content in the middle of */is comment 4. comment 1> the commented 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? From. o file size can be indirectly seen that the annotated code is not compiled 2> check the role of the Code 3> exclude error 5. nesting of comments 1) single-row comments can be nested with single-row comments and multiple-row comments // wow Haha // heh /// * fsdfsdf * /// sdfsdfsd2) multi-line comments can be nested with single-line comments/* // Author: MJ // Description: The first C language program function: This is a main function, the entry point of the C program */3) multi-line comments cannot be nested multi-line comments/* hahaha/* */4) the following statements are incorrect // * hahaha */6. annotation importance? 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, )? 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 .? You have been in a company for more than a 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. 7. exercise to see if the following program can run successfully. If yes, run the result: 1> program 1 // main function int main () {printf ("itcast \ n "); return 0;} 2> Program 2 // main function int main () {printf ("// itcast \ n"); return 0 ;} 3> Program 3 main function int main () {printf ("itcast \ n"); return 0;} 4> program 4int main () {printf (// "itcast \ n"); return 0;} 5> program 5int main () // main function {// printf ("itcast \ n "); return 0 ;}

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.