Statements and definitions

Source: Internet
Author: User

When I read the book, I saw the explanation and definition. I tried to answer the question. Although the difference was not far away, it was still not perfect. So I checked the information, as shown below:

What is definition: the so-called definition is (the compiler) to create an object, allocate a piece of memory for this object and give it a name, this name is what we often call the variable name or object name. But note that this name matches the memory (it can be imagined that this name is married to this space, and there is no bride price. ^_^. And the memory location cannot be changed. A variable or object can only be defined once within a certain region (such as in a function or globally). If it is defined multiple times, the compiler will prompt you to repeatedly define the same variable or object. What is Declaration: There are two meanings: the first meaning: Tell the compiler that the name has already matched a piece of memory (where will I go if I am married? How to solve the problem, only porridge), the following code uses variables or objects are defined elsewhere. The statement can appear multiple times. Double meaning: Tell the compiler that I have made a reservation for this name, and I can no longer use it as a variable name or object name elsewhere. For example, if you place a book in a seat in the study room of the library, it indicates that someone has made a reservation for this seat and others are no longer allowed to use it. In fact, you are not sitting in this seat at this time. The most typical example of such declaration is the declaration of function parameters, for example: void fun (int I, char C); well, we can clearly judge this explanation:) yes. B) Yes. Then their differences are clear. Remember, the most important difference between definition Declaration: The definition creates an object and declares a variable for this extern as being declared in other files (or as a reference variable) return subroutine Return Statement (either with or without parameters) void declares that the function has no return value or no parameter, and declares that the null type pointer continue ends the current loop, start the next round of do loop statement loop body while loop statement loop condition if Condition Statement else Condition Statement negative Branch (used with if) for a loop Statement (may be unspeakable) the Goto unconditional jump statement sizeof calculates the memory space occupied by the object. The object is allocated with memory and declares that no memory is allocated (a man holding the letter and drinking porridge. Pai_^

 

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.