Read the C programming language (2)

Source: Internet
Author: User

The first chapter is read. This chapter mainly introduces the C language as a whole and does not involve too many details. It tries to give readers an overall impression and allow them to write some non-Complex C Programs immediately. This is very important. The author makes it clear that "the only way to learn a new programming language is by writing programs in it. "This is totally different from the idea of Xiaoqiang in that year. After I completed this course, I tried it and scored over 80 points. I didn't write several programs on the computer during the whole process, other students can't go anywhere. It can be said that I still won't write programs after I finish learning the C language. In my impression, C language is a course with many knowledge points and is confusing. To take a high score, just remember these knowledge points and carry a few "classic programs" before the test. Sad.

After teaching everyone to print "Hello, world" in C language, the author summarized the features of C program in one sentence: "a c program, whatever its size, consists of functions and variables. "a c program, regardless of its size, is composed of functions and variables. This is a high-level generalization of the C program, reflecting that the C language is a structured programming language. C language execution is an execution sequence starting from the main function. Complex C Programs call various custom functions and variables during execution.

When introducing C-language functions, the author mentioned: "A function provides a convenient way to encapsulate some computation, which can then be used without worrying about its implementation. with properly designed funned, it is possible to ignore how a job is done; knowing what is done is sufficient. "From these words, we can see that the function is designed for functional abstraction. As a function block, you don't need to worry about how it is implemented. You only need to know what it can do to use it. This is consistent with the idea of functional abstraction at a higher level in the future. The object-oriented and componentized programming that emerged after the C language is not aimed at improving functional abstraction.

Anyone who has learned C language knows that parameter transfer during function calling is divided into value-based call and reference-based call. I am very clear about this, but I have never gone into the two reasons. In this book, the author explains why function calls in C language are passed by default: "Call by value is an asset, however, not a liability. it usually leads to more compact programs with fewer extraneous variables, because parameters can be treated as conveniently initialized local variables in the called routine. "it can be seen that the purpose of Value-Based calling is to facilitate function writers, because parameters can be used as initialized local variables, making the program more concise.

Finally, there are several details worth noting:

  • The difference between argument and parameter. Argument usually refers to the real parameter, while parameter usually refers to the form parameter.
  • If both operands of the arithmetic operator are integers, the operation is performed by integer. If one is an integer and the other is a floating point, the operation is performed by converting the integer to a floating point.
  • How to generate an EOF (end of file) from the keyboard ). In UNIX, it is usually Ctrl + D, and in DOS/Windows, it is usually Ctrl + Z.

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.