Why is my respond invalid?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is my respond invalid??

Which of the following statement is valid? (this is a challenge question exactly.) int *arr = new int ; (my respond) int *arr = new int [5]; (true answer) i think both of them are correct.

31st Mar 2019, 11:13 PM
Alireza Abbasi
Alireza Abbasi - avatar
2 Answers
+ 3
Your answer is definitely correct. The name given to a variable 'arr' doesn't implies at all it is an array.. I may call my array just like this int aSingleValueOnly_nothingMore_ofTypeFloat[10 ] = {0}; And this is perfectly correct. Obviously the name is a little misleading. The quizzes are not always perfect..
1st Apr 2019, 11:59 AM
AZTECCO
AZTECCO - avatar
0
You can see this question here. https://www.sololearn.com/post/80568/?ref=app
1st Apr 2019, 4:11 AM
Alireza Abbasi
Alireza Abbasi - avatar