I am facing problem in understanding the meaning of------ helpers.c:90:3: error: expected identifier or '(' Please guide me in correcting this error. Thanks a lot in advance.

1 Answer 1


The error message usually means that you are writing something outside a function that is not allowed there.

We would need at least line 90 and probably also the lines around to find the mistake in your code. If you want to show larger parts of your non-working code, consider uploading it to a service like https://gist.github.com/, if it's just a few lines you can put them in here, use the {} button in the question/answer editor if needed.

Without the actual code, here's a guess. If that solves your problem, please accept the answer, if not, provide more information.

This error message can be caused by multiple things. A common one is code like

char* question(int answer); // was meant to start a function definition
    if (answer == 42)
        return "What is 6 times 9?"; // playing too much scrabble...
        return "Dunno.";

The first line looks like the beginning of a function definition, but by adding a ;, it's actually a function declaration, telling the compiler what a function looks like, but not defining it. The next line starting with { is pretty confusing then, the compiler doesn't know what to do and throws an error. In that case, removing the ; (and if you forgot it adding a {) is the solution.

The same can also happen when dealing with unbalanced curly braces. You think you are still in the function, but for the compiler, that just counts { and }, you already closed it. Being consistent with indentation can help find such mistakes, and many text editors targeting developers will highlight matching parentheses/braces/brackets.

Line 90 is more than my solution had in total, so you might want to simplify your code, reduce duplication, reduce if statements, move as much as possible into common paths. Shorter, better structured code has less room for bugs to hide (unless it's so short that it's cryptic).

  • Thanks a lot for your help. Now it is coming up with one more error which is--helpers.c:91:6: error: expected function body after function declarator if (strcmp(note, "C") == 0). PLEASE HELP!!
    – Padma
    Commented Nov 14, 2018 at 5:07
  • Without code, hard to guess. Upload to something like github gist and provide link (you did not forget a {, did you?)
    – Blauelf
    Commented Nov 14, 2018 at 7:16
  • char* question (int answer) if (strcmp(note, "C") == 0) { return 16.35; } else if (strcmp(note, "C#") == 0 || strcmp(note, "Db") == 0) { return 17.32; } my code giving the error --error: expected function body after function declarator if (strcmp(note, "C") == 0) ^ THANKS FOR HELPING ALWAYS
    – Padma
    Commented Nov 14, 2018 at 12:31
  • The char* question(int answer) with the erroneous ; was meant as an example how beginners often mess up function definitions, for not giving away any part of the solution to this particular problem. The only functions you should have are duration, frequency, and is_rest, and all of them start with a line like int frequency(string note) followed by a { (and exactly the same number of { and }).
    – Blauelf
    Commented Nov 14, 2018 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .