What is wrong with this Code?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with this Code??

#include<iostream> using namespace std; int main() { int crash[10], i; for(i=0; i<100; i++) { crash[i] = i; } cout<<"Done"; }

28th Oct 2020, 4:20 AM
Naveed Ahmad Shah
Naveed Ahmad Shah - avatar
4 Answers
+ 3
You're trying to fill an array with length of 10 with 100 items
28th Oct 2020, 4:31 AM
Artem 🇺🇦
Artem 🇺🇦 - avatar
+ 2
Mean I should use crash[100] instead of 10
28th Oct 2020, 4:32 AM
Naveed Ahmad Shah
Naveed Ahmad Shah - avatar
28th Oct 2020, 4:33 AM
Artem 🇺🇦
Artem 🇺🇦 - avatar
0
I got it
28th Oct 2020, 4:34 AM
Naveed Ahmad Shah
Naveed Ahmad Shah - avatar