Skip to content

Commit d847198

Browse files
Updated C6201
Spacing fixed
1 parent a48bd5e commit d847198

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docs/code-quality/c6201.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ The following code generates this warning. This issue stems from the **`for`** l
2727
int buff[14]; // array of 0..13 elements
2828
void f()
2929
{
30-
for (int i=0; i<=14;i++) // i exceeds the index
31-
{
32-
buff[i]= 0; // warning C6200
33-
// code...
34-
}
30+
for (int i = 0; i <= 14; i++) // i exceeds the index
31+
{
32+
buff[i] = 0; // warning C6200
33+
}
3534
}
3635
```
3736

@@ -41,10 +40,9 @@ To correct both warnings, use correct array size as shown in the following code:
4140
int buff[14]; // array of 0..13 elements
4241
void f()
4342
{
44-
for ( int i=0; i < 14; i++) // i = 13 on the final iteration
45-
{
46-
buff[i]= 0; // initialize buffer
47-
// code...
48-
}
43+
for (int i = 0; i < 14; i++) // i == 13 on the final iteration
44+
{
45+
buff[i]= 0; // initialize buffer
46+
}
4947
}
5048
```

0 commit comments

Comments
 (0)