Your program is not a Standard compliant program.
Any standard compliant compiler is required to issue a diagnostic when attempting to compile it.
If Dev-C++ compiled it without a warning, the compiler was invoked in a non compliance mode.
Other than the required diagnostic, a compliant compiler can attempt to compile anyway or just plainly abort compilation.
main()
In C89 this is valid and requires no diagnostic, In C99 this is invalid and requires a diagnostic (valid C99 definitions are int main(void)
or int main(int argc, char **argv)
or equivalent) ... so if you are using a compliant compiler it is a C89 compiler.
scanf("%d",&n);
int arr[n];
Oops, this is invalid in C89. In C89 you cannot have code intermixed with declarations. A C89 compiler must issue a diagnostic when it sees the declaration of the array.
So ... you are using your compiler in a non-conforming way. There's no way to tell why it compiles or fails to compile.