The difference between typedef Define static extern

Source: Internet
Author: User

The difference between typedef Define static extern

1) #define #definepi 3.1415926

In the program: Pi*r*r is replaced with the number in the # define statement 9 g

2) A typedef is processed at compile time. It gives an alias to an already existing type within its scope, but you cannot use the typedef specifier inside a function definition.

extern can be placed before a variable or function to represent the definition of a variable or function in another file, prompting the compiler to find its definition in other modules when it encounters this variable or function. In addition, extern can also be used to specify links.

Static as a keyword and function appears in other advanced computer languages such as Fortran, ALGOL, COBOL, BASIC, LISP, Snobol, PL/1, Pascal, PROLOG, Ada and other languages have appeared, but have different roles.

The difference is:

1, global variables are not explicitly used static modified global variables, the global variable by default is externally linked, scope is the entire project, in one file defined global variables, in another file, through the extern global variable name declaration, you can use global variables;

2. A global static variable is a global variable that is explicitly modified with static, scoped to the file where the variable is declared, and the other file is not used with the extern declaration.

The difference between typedef Define static extern

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.