CCoding Style - Use Idioms for consistency
Use Idioms for consistency
Like natural languages, programming languages have idioms. A central part of learning any language is developing a familiarity with its idioms.
i = 0; While( i <= n–1 ) array[i++] = 1.0;
for( i = 0; i < n; ) array[i++] = 1.0;
for( i = n; --i; i >= 0 ) array[i] = 1.0
All of the above are correct, but the idiomatic form is like this:
for( i = 0; i < n; i++ ) array[i] = 1.0;