I use VS C++ 2008, and I have the following code

int main()
{
	int maze_size=5;
	int[3][2] oppo_pos = {
		{maze_size-1,maze_size-1},
		{maze_size-1,0},
		{0,maze_size-1}
	};
	return 0;
}

When I compiled, VS gave out the following error messages:

1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : warning C4091: '' : ignored on left of 'int' when no variable is declared
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ';' before '['
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C3409: empty attribute block is not allowed
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ']' before 'constant'
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ';' before 'constant'
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ';' before ']'
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ';' before ']'
1>c:\dev\visual studio 2008\projects\test\main.cpp(4) : error C2143: syntax error : missing ';' before '{'
1>c:\dev\visual studio 2008\projects\test\main.cpp(5) : error C2143: syntax error : missing ';' before '}'
1>c:\dev\visual studio 2008\projects\test\main.cpp(5) : error C2143: syntax error : missing ';' before ','
1>c:\dev\visual studio 2008\projects\test\main.cpp(6) : error C2143: syntax error : missing ';' before '{'
1>c:\dev\visual studio 2008\projects\test\main.cpp(6) : error C2143: syntax error : missing ';' before '}'
1>c:\dev\visual studio 2008\projects\test\main.cpp(6) : error C2143: syntax error : missing ';' before ','
1>c:\dev\visual studio 2008\projects\test\main.cpp(7) : error C2143: syntax error : missing ';' before '{'
1>c:\dev\visual studio 2008\projects\test\main.cpp(7) : error C2143: syntax error : missing ';' before '}'


Could anybody tell me what happen?

>Could anybody tell me what happen?
You don't know how to properly declare an array in C++:

int main()
{
	int maze_size=5;
	int oppo_pos[3][2] = {
		{maze_size-1,maze_size-1},
		{maze_size-1,0},
		{0,maze_size-1}
	};
	return 0;
}
This article has been dead for over six months. Start a new discussion instead.