Error in program with methods+arrays

Hello, I'm new to C++ and I made a practice program involving methods and arrays. I ran into a compile-time error on line 8 of this program (see below), which told me - "error: expected initializer before 'int'". I am using an IDE called 'CodeBlocks'.

My program:
------------------------------------------------------------

#include <stdio.h>
#include <iostream.h>

// Prototype declaration
void outputValues (int integerArray[])


int main () // This is line 8, there's supposed to be an error here
{
cout << "This program asks the user for 5 integer values and then outputs them in order";
cout << "\n\n";

//int accumulator = 0;
int array[5];
int currentValue;

for (int count = 0; count < 5; count++)
{
cout << "Enter integer value #" << (count + 1) << ": ";
cin >> currentValue;
array[count] = currentValue;
}

// now output the values entered
outputValues (array);

return 0;
}

void outputValues (int integerArray[])
{
cout << "Here are the 5 values:\n";

for (int count = 0; count < 5; count++)
{
cout.width(3);
cout << "Value #" << (count + 1) << ": " << integerArray[count] << "\n";
}
}

---------------------------------------------------------

If anyone can see something I did wrong please tell me, thank you very much.

P.S. I assure you this isn't a homework question/program, as learning C++ is not in my high school curriculum.
please use the [c0de] [/c0de] (replace 0 with o) tags for your code.

1
2
// Prototype declaration
void outputValues (int integerArray[])


You need semi-colon at the end of the prototype.
Last edited on
Topic archived. No new replies allowed.