0
Why this is not giving output as expected even when not giving any error ?
3 Answers
+ 4
G'day Abhay mishra you have return 0; inside your loop.
Move it to the outside of the loop curly brace.
+ 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.
+ 1
Thank you sir