+ 2

Pascal Triangle

Can anyone fix this program! Desktop: working fine on me ;) Mobile editor: working first column on me :l Sololearn: working first row on me, haha Why this program behaving abnormally? Or this is any logic mistake? https://code.sololearn.com/cQ7sVXCfQFIP/?ref=app

10th Jan 2021, 5:56 PM
Kashyap Kumar
Kashyap Kumar - avatar
3 odpowiedzi
+ 7
Increase the array size at #define MAX to say 50 and it should work
10th Jan 2021, 6:10 PM
Aditya
Aditya - avatar
+ 6
It's a case of overflow say size of declared array is less as far as the n (number here 5) needs so it garbage value is associated to the index where there's insufficient memory. Unlike java we don't have array outofbound exception so it's improper to rename it.. but yes the concept is same. //I may be a bit incorrect 🤷‍♂️
10th Jan 2021, 6:22 PM
Aditya
Aditya - avatar
+ 2
Aditya yeah working now, can you tell me the reason why it's not working with the value 10
10th Jan 2021, 6:12 PM
Kashyap Kumar
Kashyap Kumar - avatar