Jump to content
  • Advertisement
Sign in to follow this  
sfx81

enums in c++

This topic is 3033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all. I do understand basics of enum and typedef in c++. However I came across this, and dont understand what it is supposed to do.

typedef enum{red, green, yellow} *Col;

and can someone plz give an example of how to use it, I am confused with "*" bit in there ??
Any help will be appreciated.

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Its declaring a typename Col that is of pointer type to an unnamed enumeration.
Which is silly.

enum Color { Red, Green, Yellow }; if you must, typedef enum and typedef struct are not necessary in C++, and are mainly holdovers from C.

Although defining your color as an enumeration probably isn't what you want, depends on usage though.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!