[VC ++ getting started] After half a day, I finally know what the C ++ header file h and the source file CPP are doing.

Source: Internet
Author: User
Many people are switching from C ++ to C #, but I learned C ++ from C. I used vs to build a C ++ project for the first time, but I was bored as soon as I first saw it. I don't know what's going on, I cannot understand the relationship between the files in it. Today, I finally figured it out that the hfile and CPP file, that is, declare in the hfile, and define in the CPP file. To understand this, we only need to understand the statements and definitions, but we are still not used to press Enter. The smart prompts in C ++ are just like those in C...

"Declaration" introduces the name to the computer and says, "What does this name mean ". The definition assigns a bucket for this name. Both variables and functions have the same meaning. In either case, the compiler allocates storage space in the "definition. For variables, the compiler determines the number of storage units occupied by the variables and generates space for them in the memory. For functions, the compiler generatesCodeAnd allocate storage space for it. A function bucket contains a pointer generated by a function name without a parameter table or an address operator. The definition can also be a declaration. If the compiler has not seen the name,ProgramThe compiler immediately allocates a storage address for the name if int A is defined by the Member. Declarations often use the e x t e r n keyword. If we declare a variable rather than define it, we need to use e x t e r n. For function declaration, e x t e r n is optional. The function name without the function body, together with the parameter table or return value, is automatically declared.

I copied the above from , I may have forgotten it next day. I should have seldom used it. This is why I remember to learn C ++ when I am doing small software. Although C # Can Do It, but not all of them are installed.

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.