Passing 2D array with variable dimensions as function argument
- by TheCrazyProgrammer
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