saloni jhanwar wrote:
gurpeet singh wrote:please refer page no. 62 of kb6 book . following is the paragraph copied from the book
here the authors have put semi-colon in the wrong place. according to me it should have been like this:
enum CoffeeSize { BIG, HUGE, OVERWHELMING ; } // note the semicolon
please confirm if i'm right ?
No that is correct, you can see many examples.
i'm not saying that it is wrong or compiler error putting semi colon at the end of curly braces. semi colon will work since it is an empty statement. what i'm asking is that further down the pages , specifically page no. 63 the book gives another example as follows :
here as you can see the semi-colon is placed after the enum constants .this is what i'm talking about. here in this case semi colon is required because there are more statements after the enum constants, whereas in earlier case it is optional . the main point is the location of the semi colon. i think that might be some typing error .