hi can u ppl help me on this.
can i use multiple enums in a single c program, if so is there any constrain on it?

enum pattern1 {red, green, yellow} pt1;
enum pattern2 {orange, blue, black} p2;
enum pattern3 {white, grey, violet} p3;

is this possible????

Recommended Answers

All 2 Replies

Yes, you can. You can not have conflicting values, however. For instance, the following will not work:

enum enum1 { FOO , BAR } e1;
enum enum2 { BAR, BAZ } e2;

due to the redefinition of the enum tag BAR

Yes, you can. You can not have conflicting values, however. For instance, the following will not work:

enum enum1 { FOO , BAR } e1;
enum enum2 { BAR, BAZ } e2;

due to the redefinition of the enum tag BAR

thanks,,,,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.