Passing 2D array with variable dimensions as function argument

Posted by TheCrazyProgrammer on Stack Overflow See other posts from Stack Overflow or by TheCrazyProgrammer
Published on 2012-12-11T10:27:58Z Indexed on 2012/12/11 11:03 UTC
Read the original article Hit count: 213

I just saw the following code among the successful submissions at codechef.

http://www.codechef.com/viewplaintext/1595846

I used to think that

float max(int n,int arr[n][n])
{....}

is not allowed in C++ (as 'n' is a variable). My CodeBlocks (on windows) with MinGW [gcc 4.4] gives compile time error. that "error: array bound is not an integer constant.

Then how can be such a solution be accepted by CodeChef's judge. Is there any special flag that allows us to do that in C++???

EDIT: A link showing status as AC (accepted) : http://www.codechef.com/viewsolution/1595846

© Stack Overflow or respective owner

Related posts about c++

Related posts about arrays