+ 2
Need help!!!
Hello everyone! I really need help. I've written some code to play with a single linked list. But I can't understand why the last function in code ( int deleteNodeAnyPosition(nodePtr *pTr, int position) doesn't work. I've had a gcc compiler warning about it - "main.c|343|error: expected declaration or statement at end of input|".But I can't fix this problem. Here code: https://code.sololearn.com/c9JyFZ60qFS2
3 odpowiedzi
+ 4
There's a missing ending curly brace on the previous function insertAtSpecPosition().
if (*pTr == NULL) {
. . .
}
else {
. . .
<--- Missing.
Insert } before return 1; and it will compile. I would still follow Felipe BF's advice and indent it properly. It will make mistakes like these easier to catch.
+ 4
I suggest you re-indent your code (using an editor such as Notepad++ or Sublime Text) and check for any missing braces or parentheses.
Source: https://stackoverflow.com/a/8707921
+ 3
Tanks a lot!!!, Yes the problem was with curly brace in previous function. Now works fine.