Skip to content

Commit f6bca8b

Browse files
author
Colin Robertson
committed
Add style fixes for grammar
1 parent ef0bfad commit f6bca8b

6 files changed

Lines changed: 179 additions & 181 deletions

‎docs/c-language/initializing-scalar-types.md‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ ms.assetid: 73c516f5-c3ad-4d56-ab3b-f2a82b621104
66
---
77
# Initializing Scalar Types
88

9-
When initializing scalar types, the value of the *assignment-expression* is assigned to the variable. The conversion rules for assignment apply. (See [Type Conversions](../c-language/type-conversions-c.md) for information on conversion rules.)
9+
When initializing scalar types, the value of the *`assignment-expression`* is assigned to the variable. The conversion rules for assignment apply. (See [Type Conversions](../c-language/type-conversions-c.md) for information on conversion rules.)
1010

1111
## Syntax
1212

13-
*declaration*:<br/>
14-
&nbsp;&nbsp;&nbsp;&nbsp;*declaration-specifiers* *init-declarator-list*<sub>opt</sub> **;**
13+
*`declaration`*:<br/>
14+
&nbsp;&nbsp;&nbsp;&nbsp;*`declaration-specifiers`* *`init-declarator-list`*<sub>opt</sub> **`;`**
1515

16-
*declaration-specifiers*:<br/>
17-
&nbsp;&nbsp;&nbsp;&nbsp;*storage-class-specifier* *declaration-specifiers*<sub>opt</sub> <br/>
18-
&nbsp;&nbsp;&nbsp;&nbsp;*type-specifier* *declaration-specifiers*<sub>opt</sub> <br/>
19-
&nbsp;&nbsp;&nbsp;&nbsp;*type-qualifier* *declaration-specifiers*<sub>opt</sub>
16+
*`declaration-specifiers`*:<br/>
17+
&nbsp;&nbsp;&nbsp;&nbsp;*`storage-class-specifier`* *`declaration-specifiers`*<sub>opt</sub> <br/>
18+
&nbsp;&nbsp;&nbsp;&nbsp;*`type-specifier`* *`declaration-specifiers`*<sub>opt</sub> <br/>
19+
&nbsp;&nbsp;&nbsp;&nbsp;*`type-qualifier`* *`declaration-specifiers`*<sub>opt</sub>
2020

21-
*init-declarator-list*:<br/>
22-
&nbsp;&nbsp;&nbsp;&nbsp;*init-declarator*<br/>
23-
&nbsp;&nbsp;&nbsp;&nbsp;*init-declarator-list* **,** *init-declarator*
21+
*`init-declarator-list`*:<br/>
22+
&nbsp;&nbsp;&nbsp;&nbsp;*`init-declarator`*<br/>
23+
&nbsp;&nbsp;&nbsp;&nbsp;*`init-declarator-list`* **`,`** *`init-declarator`*
2424

25-
*init-declarator*:<br/>
26-
&nbsp;&nbsp;&nbsp;&nbsp;*declarator*<br/>
27-
&nbsp;&nbsp;&nbsp;&nbsp;*declarator* **=** *initializer* /\* For scalar initialization \*/
25+
*`init-declarator`*:<br/>
26+
&nbsp;&nbsp;&nbsp;&nbsp;*`declarator`*<br/>
27+
&nbsp;&nbsp;&nbsp;&nbsp;*`declarator`* **`=`** *`initializer`* /\* For scalar initialization \*/
2828

29-
*initializer*:<br/>
30-
&nbsp;&nbsp;&nbsp;&nbsp;*assignment-expression*
29+
*`initializer`*:<br/>
30+
&nbsp;&nbsp;&nbsp;&nbsp;*`assignment-expression`*
3131

3232
You can initialize variables of any type, provided that you obey the following rules:
3333

3434
- Variables declared at the file-scope level can be initialized. If you do not explicitly initialize a variable at the external level, it is initialized to 0 by default.
3535

36-
- A constant expression can be used to initialize any global variable declared with the **`static`** *storage-class-specifier*. Variables declared to be **`static`** are initialized when program execution begins. If you do not explicitly initialize a global **`static`** variable, it is initialized to 0 by default, and every member that has pointer type is assigned a null pointer.
36+
- A constant expression can be used to initialize any global variable declared with the **`static`** *`storage-class-specifier`*. Variables declared to be **`static`** are initialized when program execution begins. If you do not explicitly initialize a global **`static`** variable, it is initialized to 0 by default, and every member that has pointer type is assigned a null pointer.
3737

3838
- Variables declared with the **`auto`** or **`register`** storage-class specifier are initialized each time execution control passes to the block in which they are declared. If you omit an initializer from the declaration of an **`auto`** or **`register`** variable, the initial value of the variable is undefined. For automatic and register values, the initializer is not restricted to being a constant; it can be any expression involving previously defined values, even function calls.
3939

@@ -61,7 +61,7 @@ The pointer `px` is initialized to 0, producing a "null" pointer.
6161
const int c = (3 * 1024);
6262
```
6363

64-
This example uses a constant expression `(3 * 1024)` to initialize `c` to a constant value that cannot be modified because of the **const** keyword.
64+
This example uses a constant expression `(3 * 1024)` to initialize `c` to a constant value that cannot be modified because of the **`const`** keyword.
6565

6666
```C
6767
int *b = &x;

‎docs/c-language/overview-of-declarations.md‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ A "declaration" specifies the interpretation and attributes of a set of identifi
1010

1111
## Syntax
1212

13-
*declaration*:<br/>
14-
&nbsp;&nbsp;&nbsp;&nbsp;*declaration-specifiers* *attribute-seq*<sub>opt</sub> *init-declarator-list*<sub>opt</sub>**;**
13+
*`declaration`*:<br/>
14+
&nbsp;&nbsp;&nbsp;&nbsp;*`declaration-specifiers`* *`attribute-seq`*<sub>opt</sub> *`init-declarator-list`*<sub>opt</sub>**`;`**
1515

16-
/\* *attribute-seq*<sub>opt</sub> is Microsoft-specific */
16+
/\* *`attribute-seq`*<sub>opt</sub> is Microsoft-specific */
1717

18-
*declaration-specifiers*:<br/>
19-
&nbsp;&nbsp;&nbsp;&nbsp;*storage-class-specifier* *declaration-specifiers*<sub>opt</sub><br/>
20-
&nbsp;&nbsp;&nbsp;&nbsp;*type-specifier* *declaration-specifiers*<sub>opt</sub><br/>
21-
&nbsp;&nbsp;&nbsp;&nbsp;*type-qualifier* *declaration-specifiers*<sub>opt</sub>
18+
*`declaration-specifiers`*:<br/>
19+
&nbsp;&nbsp;&nbsp;&nbsp;*`storage-class-specifier`* *`declaration-specifiers`*<sub>opt</sub><br/>
20+
&nbsp;&nbsp;&nbsp;&nbsp;*`type-specifier`* *`declaration-specifiers`*<sub>opt</sub><br/>
21+
&nbsp;&nbsp;&nbsp;&nbsp;*`type-qualifier`* *`declaration-specifiers`*<sub>opt</sub>
2222

23-
*init-declarator-list*:<br/>
24-
&nbsp;&nbsp;&nbsp;&nbsp;*init-declarator*<br/>
25-
&nbsp;&nbsp;&nbsp;&nbsp;*init-declarator-list* **,** *init-declarator*
23+
*`init-declarator-list`*:<br/>
24+
&nbsp;&nbsp;&nbsp;&nbsp;*`init-declarator`*<br/>
25+
&nbsp;&nbsp;&nbsp;&nbsp;*`init-declarator-list`* **`,`** *`init-declarator`*
2626

27-
*init-declarator*:<br/>
28-
&nbsp;&nbsp;&nbsp;&nbsp;*declarator*<br/>
29-
&nbsp;&nbsp;&nbsp;&nbsp;*declarator* **=** *initializer*
27+
*`init-declarator`*:<br/>
28+
&nbsp;&nbsp;&nbsp;&nbsp;*`declarator`*<br/>
29+
&nbsp;&nbsp;&nbsp;&nbsp;*`declarator`* **`=`** *`initializer`*
3030

3131
> [!NOTE]
32-
> This syntax for *declaration* is not repeated in the following sections. Syntax in the following sections usually begins with the *declarator* nonterminal.
32+
> This syntax for *`declaration`* is not repeated in the following sections. Syntax in the following sections usually begins with the *`declarator`* nonterminal.
3333
34-
The declarations in the *init-declarator-list* contain the identifiers being named; *init* is an abbreviation for initializer. The *init-declarator-list* is a comma-separated sequence of declarators, each of which can have additional type information, or an initializer, or both. The *declarator* contains the identifiers, if any, being declared. The *declaration-specifiers* nonterminal consists of a sequence of type and storage-class specifiers that indicate the linkage, storage duration, and at least part of the type of the entities that the declarators denote. Therefore, declarations are made up of some combination of storage-class specifiers, type specifiers, type qualifiers, declarators, and initializers.
34+
The declarations in the *`init-declarator-list`* contain the identifiers being named; *`init`* is an abbreviation for initializer. The *`init-declarator-list`* is a comma-separated sequence of declarators, each of which can have additional type information, or an initializer, or both. The *`declarator`* contains the identifiers, if any, being declared. The *`declaration-specifiers`* nonterminal consists of a sequence of type and storage-class specifiers that indicate the linkage, storage duration, and at least part of the type of the entities that the declarators denote. Declarations are made up of some combination of storage-class specifiers, type specifiers, type qualifiers, declarators, and initializers.
3535

36-
Declarations can contain one or more of the optional attributes listed in *attribute-seq*; *seq* is an abbreviation for sequence. These Microsoft-specific attributes perform a variety of functions, which are discussed in detail throughout this book.
36+
Declarations can contain one or more of the optional attributes listed in *`attribute-seq`*; *`seq`* is an abbreviation for sequence. These Microsoft-specific attributes perform several functions, which are discussed in detail throughout this book.
3737

38-
In the general form of a variable declaration, *type-specifier* gives the data type of the variable. The *type-specifier* can be a compound, as when the type is modified by **`const`** or **`volatile`**. The `declarator` gives the name of the variable, possibly modified to declare an array or a pointer type. For example,
38+
In the general form of a variable declaration, *`type-specifier`* gives the data type of the variable. The *`type-specifier`* can be a compound, as when the type is modified by **`const`** or **`volatile`**. The `declarator` gives the name of the variable, possibly modified to declare an array or a pointer type. For example,
3939

4040
```C
4141
int const *fp;
@@ -45,17 +45,17 @@ declares a variable named `fp` as a pointer to a nonmodifiable (**`const`**) **`
4545

4646
A declaration must have at least one declarator, or its type specifier must declare a structure tag, union tag, or members of an enumeration. Declarators provide any remaining information about an identifier. A declarator is an identifier that can be modified with brackets (**`[ ]`**), asterisks (<strong>`*`</strong>), or parentheses ( **`( )`** ) to declare an array, pointer, or function type, respectively. When you declare simple variables (such as character, integer, and floating-point items), or structures and unions of simple variables, the `declarator` is just an identifier. For more information on declarators, see [Declarators and Variable Declarations](../c-language/declarators-and-variable-declarations.md).
4747

48-
All definitions are implicitly declarations, but not all declarations are definitions. For example, variable declarations that begin with the **`extern`** storage-class specifier are "referencing," rather than "defining" declarations. If an external variable is to be referred to before it is defined, or if it is defined in another source file from the one where it is used, an **`extern`** declaration is necessary. Storage is not allocated by "referencing" declarations, nor can variables be initialized in declarations.
48+
All definitions are implicitly declarations, but not all declarations are definitions. For example, variable declarations that begin with the **`extern`** storage-class specifier are "referencing," rather than "defining" declarations. If an external variable is to be referred to before it's defined, or if it's defined in another source file from the one where it's used, an **`extern`** declaration is necessary. Storage is not allocated by "referencing" declarations, nor can variables be initialized in declarations.
4949

50-
A storage class or a type (or both) is required in variable declarations. Except for **`__declspec`**, only one storage-class specifier is allowed in a declaration and not all storage-class specifiers are permitted in every context. The **`__declspec`** storage class is allowed with other storage-class specifiers, and it is allowed more than once. The storage-class specifier of a declaration affects how the declared item is stored and initialized, and which parts of a program can reference the item.
50+
A storage class or a type (or both) is required in variable declarations. Except for **`__declspec`**, only one storage-class specifier is allowed in a declaration and not all storage-class specifiers are permitted in every context. The **`__declspec`** storage class is allowed with other storage-class specifiers, and it's allowed more than once. The storage-class specifier of a declaration affects how the declared item is stored and initialized, and which parts of a program can reference the item.
5151

52-
The *storage-class-specifier* terminals defined in C include **`auto`**, **`extern`**, **`register`**, **`static`**, and **`typedef`**. In addition, Microsoft C includes the *storage-class-specifier* terminal **`__declspec`**. All *storage-class-specifier* terminals except **`typedef`** and **`__declspec`** are discussed in [Storage Classes](../c-language/c-storage-classes.md). See [`typedef` Declarations](../c-language/typedef-declarations.md) for information about **`typedef`**. See [Extended Storage-Class Attributes](../c-language/c-extended-storage-class-attributes.md) for information about **`__declspec`**.
52+
The *`storage-class-specifier`* terminals defined in C include **`auto`**, **`extern`**, **`register`**, **`static`**, and **`typedef`**. Microsoft C also includes the *`storage-class-specifier`* terminal **`__declspec`**. All *`storage-class-specifier`* terminals except **`typedef`** and **`__declspec`** are discussed in [Storage Classes](../c-language/c-storage-classes.md). For information about **`typedef`**, see [`typedef` Declarations](../c-language/typedef-declarations.md). For information about **`__declspec`**, see [Extended Storage-Class Attributes](../c-language/c-extended-storage-class-attributes.md).
5353

54-
The location of the declaration within the source program and the presence or absence of other declarations of the variable are important factors in determining the lifetime of variables. There can be multiple redeclarations but only one definition. However, a definition can appear in more than one translation unit. For objects with internal linkage, this rule applies separately to each translation unit, because internally linked objects are unique to a translation unit. For objects with external linkage, this rule applies to the entire program. See [Lifetime, Scope, Visibility, and Linkage](../c-language/lifetime-scope-visibility-and-linkage.md) for more information about visibility.
54+
The location of the declaration within the source program and the presence or absence of other declarations of the variable are important factors in determining the lifetime of variables. There can be multiple redeclarations but only one definition. However, a definition can appear in more than one translation unit. For objects with internal linkage, this rule applies separately to each translation unit, because internally linked objects are unique to a translation unit. For objects with external linkage, this rule applies to the entire program. For more information about visibility, see [Lifetime, Scope, Visibility, and Linkage](../c-language/lifetime-scope-visibility-and-linkage.md).
5555

56-
Type specifiers provide some information about the data types of identifiers. The default type specifier is **`int`**. For more information, see [Type Specifiers](../c-language/c-type-specifiers.md). Type specifiers can also define type tags, structure and union component names, and enumeration constants. For more information see [Enumeration Declarations](../c-language/c-enumeration-declarations.md), [Structure Declarations](../c-language/structure-declarations.md), and [Union Declarations](../c-language/union-declarations.md).
56+
Type specifiers provide some information about the data types of identifiers. The default type specifier is **`int`**. For more information, see [Type Specifiers](../c-language/c-type-specifiers.md). Type specifiers can also define type tags, structure and union component names, and enumeration constants. For more information, see [Enumeration Declarations](../c-language/c-enumeration-declarations.md), [Structure Declarations](../c-language/structure-declarations.md), and [Union Declarations](../c-language/union-declarations.md).
5757

58-
There are two *type-qualifier* terminals: **`const`** and **`volatile`**. These qualifiers specify additional properties of types that are relevant only when accessing objects of that type through l-values. For more information on **`const`** and **`volatile`**, see [Type Qualifiers](../c-language/type-qualifiers.md). For a definition of l-values, see [L-Value and R-Value Expressions](../c-language/l-value-and-r-value-expressions.md).
58+
There are two *`type-qualifier`* terminals: **`const`** and **`volatile`**. These qualifiers specify additional properties of types that are relevant only when accessing objects of that type through l-values. For more information on **`const`** and **`volatile`**, see [Type Qualifiers](../c-language/type-qualifiers.md). For a definition of l-values, see [L-Value and R-Value Expressions](../c-language/l-value-and-r-value-expressions.md).
5959

6060
## See also
6161

0 commit comments

Comments
 (0)