Member Avatar

I am trying to use a for loop to print the contents of a single dimensional array. I am trying to use the loop counter in the 'cout' statement to provide a heading for the contents of each array element. code is below. I am using MS Visual Studio to write and compile the code and I receive the following error when I compile:

"error C2065: 'forCounter' : undeclared identifier"

I am not sure what I am doing wrong. Please help.

for (int forCounter = 0; forCounter < wageArraySize; forCounter++ );
		cout << "Salary between $" << wageArray[ forCounter ] << "00 and $" << wageArray[ forCounter ] << "99: " << wageArray[ forCounter ] << endl;

remove the semicolon at the end of the for loop statement!

Member Avatar

That fixed it, thank you for the help.