Do some challenge questions promote bad practice? | SoloLearn: Learn to code for FREE!


Do some challenge questions promote bad practice?

Would a question such as the following promote users to write bad code such as the use of negative indexes in C++ arrays which are not protected by default by compilers such as gcc?

11/21/2019 2:17:52 AM


7 Answers

New Answer


Sonic yes this is question can be said as outdated and only run on gnu extension compilers like sololearn have. In Standard C and C++, zero-size array is not allowed.. If you're using GCC, compile it with -pedantic option. It will give warning, The code is only executable on compiler gcc and gnu version like C99 and it is treated as an error in others (e.g., Visual C++).


GAWEN STEASY thanks. OMG I had forgotten that I asked it before!! Obviously my memory is not very good or the use of C++ in my brain caused some new information to overwrite the old memory, probably using a negative array index and causing me to forget by corrupting the old memory! However, this was more of a general question for which the referenced code was an example.


Of course I would never write code such as the following other than to examine challenge question output but could it encourage anyone?


Sonic you have asked these question in past too so why again new thread I guess that time it answered already


Guys remember that if you suspect that a question is wrong, or in this case, promotes bad practices, report it so that Sololearn can evaluate it. That's the only way to get these outdated concepts out of the quizzes


most of the general questions that trip me up are bad programmming pracrices that are also valid. It can be helpful for certification prep to distinguish between validity and proper programming convention in industry.


Maybe not. Challenges are sudden and they do disrupt our studying discipline. It depends upon how you handle your challenges ( whether through betting or guess or by genuinely answering)