0
Solo learn compiler for C giving false or wrong output.
I have tried to compile a C program today via solo learn online compiler. What I have found that it is generating wrong output. For the attached code in my linux pc I have got the result is '72' for the input (lower = 1, upper = 9, operator = +3. The same code is generating '1479' in the solo learn compiler. I am preety sure that the result 72 is correct and solo learn compiler showing wrong output. Admins please take a look at this issue. https://code.sololearn.com/ctQvVijk4hom/?ref=app
5 ответов
+ 5
Line 26 assigns beyond the arr allocation overwriting result.
+ 2
char arr[3];
not
char arr[2];
You need enough space to put the end of string marker into.
+ 1
Use debugger in code blocks to see if you have any bugs to fix.
+ 1
Thank you John Wells . I have found out my mistake. Now I converted the string of arr [ ] to integer by substracting it by 48. Now the code is working fine.
+ 1
well done