What is the difference between declaring an enum with and without 'typedef'?

Posted by freitass on Stack Overflow See other posts from Stack Overflow or by freitass
Published on 2010-04-28T21:09:45Z Indexed on 2010/04/28 21:17 UTC
Read the original article Hit count: 190

Filed under:
|
|
|

The standard way of declaring an enum in C++ seems to be:

enum <identifier> { <list_of_elements> };

However, I have already seen some declarations like:

typedef enum { <list_of_elements> } <identifier>;

What is the difference between them, if it exists? Which one is correct?

© Stack Overflow or respective owner

Related posts about c++

Related posts about enums