...
| Code Block |
|---|
|
size_t i = 0;
for (i=0; i < 10; i++){
/* Perform operations. */
}
|
Compliant Solution
Complying with this recommendation requires that you declare variables where they are used, which improves readability and reusability. In this example, you would declare the loop's index variable i within the initialization of the for loop. This requirement was recently relaxed in the C Standard.
| Code Block |
|---|
|
for (size_t i=0; i < 10; i++) {
/* Perform operations. */
}
|
Noncompliant Code Example (Function Declaration)
...