Example 1 — A register loop counter
Functionally identical to an ordinary int.
#include <stdio.h>
int main(void) {
auto int sum = 0;
register int i;
for (i = 0; i < 100; i++) {
sum += i;
}
printf("sum = %d\n", sum);
return 0;
} How It Works
autochanges nothing; locals are automatic anyway.registersuggestsishould live in a register.- The loop adds 0 through 99, which totals 4950.
