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
Variable-length automatic arrays are allowed in ISO C99, and as an extension GCC accepts them in C90 mode and in C++. These arrays are declared like any other automatic arrays, but with a length that is not a constant expression.
Ref: http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html