undefined

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Previous: While-Loops Next: For-Loops - Part II

For-Loops - Part I

#include <iostream>
using namespace std;
int main() {
int an_array[10];
int i;
// initialize an_array to hold 0, 1, ..., 9
// 10 iterations are executed, corresponding to
// i = 0, 1, ..., 9
for (i = 0; i < 10; ++i) {
an_array[i] = i;
}
// print the values of the array on a single line
for (i = 0; i < 10; ++i) {
cout << an_array[i] << ' ';
}
cout << endl;
return 0;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content