+ 3
Why this c code is not working properly?
Sometimes this code leaving the get, scanf functions lines and sometimes giving garbage output values.why can anyone explain this. https://code.sololearn.com/c6FyR4ro5cY0/?ref=app
2 Respostas
+ 2
Because arrays start at 0, and you were inconsistent with your starting index `int i=1;` on line 18 while `int i=0;` on line 30. If you decide to start at 0 remember to change the end condition as well.
+ 3
jtrh and by adding
fflush(stdin);
Line after scanf function and before gets function help to not leaving the gets line.
finally i solve it.