+ 2

[C] Why am I getting a compilation error?

I don’t think it’s because of something outside of the if statement between line 64 and line 78 because whenever I comment out all the statements inside it, the compilation error doesn’t happen. However, the dilemma is that when I comment out just the do while loop or the nested if and if else statements to find out the source of the problem, the compilation error returns, implying that the source of the problem is not in the body of the if statement, but the entire if statement or even something else entirely. https://code.sololearn.com/c596jjvt0RUj/?ref=app

22nd Jun 2019, 6:41 PM
Zerokles
Zerokles - avatar
3 Answers
+ 3
Taking a closer look at the format specifier at lines 35, 36, 44, 45, 60, 61, 69, 70 reveals the horrible reality of using `%c` for handling integer argument `choice`. In addition, the string-related function `strncpy()` has been used implicitly without including its associated header file, <string.h>.
22nd Jun 2019, 7:43 PM
To Seek Glory in Battle is Glorious
To Seek Glory in Battle is Glorious - avatar
+ 1
it's working fine when I run it, on my mobile compiler
22nd Jun 2019, 6:54 PM
✳AsterisK✳
✳AsterisK✳ - avatar