enumerations

Hi.
suppose I have these definitions:

1
2
enum flower{violet, linda, mina};
    flower f;


what is wrong with the instruction
f=3

?Thanks in advance!
f is not an integer. f is a flower so you can only give it the values violet, linda or mina.
closed account (zb0S216C)
In addition to Peter87's reply:

Enumeration lists, such as "flower", introduce a new type. This means that each enumerator that pertains to "flower" is a possible value for that type. For instance, take your "f". Each enumerator of "flower" can be assigned to "f." However, "f" cannot be assigned to any other type of value.

Wazzak
Thank you all.
Topic archived. No new replies allowed.