Reputation: 27
For example:
int hello1;
int hello2;
int hello3;
for(int i = 1; i <= 3; i++)
{
helloi = 99;
}
How can I do something similar like this but with it actually working... also, sorry if I'm being vague here.
Upvotes: 3
Views: 76
Reputation: 19339
What you're looking for is an array:
int hello[3];
for (int i = 0; i < 3; ++i)
{
hello[i] = 99;
}
Note that arrays use zero-based indexing, so the indices run from 0 to 2 rather than from 1 to 3.
Upvotes: 8