Array Traversal help!!!!!!!!

I'm program a traversal array, but i got 2 errors:

1.expected unqualified-id before '{' token (line 14)
2.expected `,' or `;' before '{' token (line 14)

I AM NOT ALLOWED TO MODIFY THE MAIN INT!!!!!!!

#include <iostream>
#include <cstdlib>

using namespace std;

/* Prints the given integer array to the screen.
*
* Require: size >= 0 &&
* size == array[last+1];
* Ensure: Only array memory location are traversed &&
* output format: "{ x,y,z }"
*/

void stringifyArray (int array[], int size);{
for(int t=0; t <= size; t++)
cout << array[t] << endl;
}

int main() {
int integers_one[3] = { 0,1,3 };
int integers_two[2][3] = {{ 0,1,2 },{2,3,4}};

cout << "Integer array: " << endl;
stringifyArray(integers_one, 3);

exit(EXIT_SUCCESS);
}
closed account (o3hC5Di1)
Hi there,

on this line: void stringifyArray (int array[], int size);{ you have a semicolon ; before the { , that's causing the errors.

On a sidenote, please wrap your code in [code][/code] tags, it makes it more readable.

All the best,
NwN
Topic archived. No new replies allowed.