Friday, July 29, 2016

C Basics - Namespace in C

The compiler sets up name spaces to distinguish between the identifiers. You can use the same identifier for two or more different items, provided that the items are in different name spaces.

Statement labels: Statement labels do not have to be distinct from other names or from label names in other functions.

Structure, union, and enumeration tags: The tag names must be distinct from all other structure, enumeration, or union tags with the same visibility.

Members of structures or unions: The name of a member must be unique within the structure or union.

Ordinary identifiers:All other names fall into a name space that includes variables, functions (including formal parameters and local variables), and enumeration constants. Identifier names have nested visibility, so you can redefine them within blocks.

Typedef names:Typedef names cannot be used as identifiers in the same scope.

Related topics:
Memory Management in C   |   Incomplete Type in C   |   Lifetime, Scope, Visibility and Linkage in C   |   Complex and Abstract Declarations in C   |   Storage of Data Types in C   |   Standard Library in C

List of topics: C Programming

No comments:

Post a Comment