0

I'm doing a chemistry project for my school. It's supposed to give info about any element when its atomic number is given as input.

The code is here : http://pastebin.com/42H1SZhh ( I put it there since it's like 400 lines... )

Now, at line 47, I get this error : chemistry.c:46:3: error: expected '}' before '{' token It highlights the line that contains the opening brace for the element Helium...

{  // This line
          "HELIUM", "He", 2, 4 , -269, -272
 }

It don't really know why this problem occurs, as I've made sure my syntax is right... could anyone point out where the mistake is ? Thank you

3
  • 2
    You're missing comma's separating each array element in that initializer. (i.e after each structure closing }) Commented Nov 9, 2013 at 14:08
  • "as I've made sure my syntax is right" That sounds very self-confident. How did you make that sure? Commented Nov 9, 2013 at 14:15
  • @glglgl, well I read it a few times, and couldn't find any problems like a missing '}' or a loop without braces, I didn't know they had to be seperated by commas as long as they were in different sets of braces :) Commented Nov 13, 2013 at 2:40

1 Answer 1

4

You're missing commas between your struct initializers. You get the error message in question because without a comma, the compiler expects the thing following the first struct initializer to be the closing brace of the enclosing array initializer.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.