What happens if you leave a part of an array blank? Example: int myArray [3] = { 0, 2, }; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What happens if you leave a part of an array blank? Example: int myArray [3] = { 0, 2, };

Example: int myArray [3] ={ 0, 2, };

28th May 2018, 8:41 PM
Jeremy
4 Answers
+ 4
Assuming you refer to C++ (you didn't include C++ in tags) here's a previous discussion covering well on variable initialization topic: (Edit) C++ added into tags [Cool] https://www.sololearn.com/Discuss/1128723/?ref=app
28th May 2018, 9:33 PM
Ipang
+ 1
This is a great question. You should have posted your results you got when you experimented with this on the Code PlayGround /IDE. I think the insight you gained could be helpful to others with similar questions.
28th May 2018, 10:13 PM
ODLNT
ODLNT - avatar
0
Good idea to try in code playground. I did. The code still runs. The missing array variable gets defined as either random number or the location it is stored (not sure).
29th May 2018, 1:59 AM
Jeremy
0
may be generate some error
29th May 2018, 11:06 AM
Faizal Khan
Faizal Khan - avatar