0

Segmentation fault

Does anyone know why segmentation fault happens when i input size over 11? https://code.sololearn.com/cj2ZvrK2N1x2/?ref=app

2nd Dec 2019, 11:24 AM
mati938
mati938 - avatar
5 Respostas
+ 4
mati938 Kindly refer this thread to understand segmentation fault. Edit: Also how can an array already declared with size 10 can take size 11? https://www.sololearn.com/Discuss/2077837/?ref=app
2nd Dec 2019, 11:54 AM
Avinesh
Avinesh - avatar
+ 2
because you exceeded the size of the array. n[10][10]. when c or r is greater than 9 it will be out of index range.
2nd Dec 2019, 11:38 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
segmentation fault occurs when you try to access memory that doesnt exist.
2nd Dec 2019, 5:10 PM
minirkk
minirkk - avatar
0
Thank you all so much, I'll try to not commit this mistake again :)
3rd Dec 2019, 5:58 AM
mati938
mati938 - avatar
0
You have problems with indexes starting at zero?
4th Dec 2019, 2:53 AM
another guy
another guy - avatar