0

Why this is not giving output as expected even when not giving any error ?

https://code.sololearn.com/cOet586eMtjE/?ref=app

16th Mar 2022, 10:32 AM
Abhay mishra
Abhay mishra - avatar
3 ответов
+ 4
G'day Abhay mishra you have return 0; inside your loop. Move it to the outside of the loop curly brace.
16th Mar 2022, 10:38 AM
HungryTradie
HungryTradie - avatar
+ 3
Line 10: 4 slots allocated for <marks>, but the initialization had 5 values listed. The number in square brackets must match number of values inside the curly brackets. Line 12: If <marks> only had 4 elements, then the loop condition should be i < 4 By specifying i <= 4 as loop condition, you are attempting to refer index (0, 1, 2, 3, 4). That's 5 indices in total. An attempt to access/modify an out of bound index may lead to unexpected outcome.
16th Mar 2022, 1:43 PM
Ipang
+ 1
Thank you sir
16th Mar 2022, 10:46 AM
Abhay mishra
Abhay mishra - avatar