+ 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

19th Jun 2020, 9:15 AM
Денис Филь
Денис Филь - avatar
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.
19th Jun 2020, 9:40 AM
Gen2oo
Gen2oo - avatar
+ 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
19th Jun 2020, 9:24 AM
Felipe BF
+ 3
Tanks a lot!!!, Yes the problem was with curly brace in previous function. Now works fine.
19th Jun 2020, 7:50 PM
Денис Филь
Денис Филь - avatar