Variable declaration reset: Difference between revisions

Content added Content deleted
m (→‎{{header|C}}: Corrected program comment.)
m (→‎{{header|C}}: Seem to have lost a semi-colon.)
Line 53: Line 53:


/* Now 'gprev' is used and reassigned
/* Now 'gprev' is used and reassigned
each time around the loop producing the desired output. */
each time around the loop producing the desired output. */
for (i = 0; i < 7; ++i) {
for (i = 0; i < 7; ++i) {
int curr = s[i];
int curr = s[i];
if (i > 0 && curr == gprev) printf("%d\n", i);
if (i > 0 && curr == gprev) printf("%d\n", i);
gprev = curr
gprev = curr;
}
}