+ 1

Cpp: (int n=1; int draft [n];) is this correct way of using array

My compiler(devc++) runs it. but SoloLearn cant run it. Here is my code: https://code.sololearn.com/cUF2UhT7IlVC/

1st Nov 2018, 10:32 AM
sina
sina - avatar
3 Respostas
+ 1
In Sololearn you have to give all inputs in advance, so cins in branches does not work here unfortunately :/
1st Nov 2018, 11:16 AM
Matthias
Matthias - avatar
+ 1
In C this correct. In C++ this is incorect, but if you make n const it is correct. Btw, welcome to C/C++ cross-platform development: almost all code is non-standard and everyone relies on the behavior of their compiler.
1st Nov 2018, 12:13 PM
Vlad Serbu
Vlad Serbu - avatar
0
Omg lol. For some reason my compiler runs this. But i guess we just count this as non standard method. Tbh it takes 5 seconds to just start the code when i first compiled it.
1st Nov 2018, 5:25 PM
sina
sina - avatar