enuma rations

Upload: shivuhc

Post on 03-Nov-2015

219 views

Category:

Documents


0 download

DESCRIPTION

C

TRANSCRIPT

  • ENUMERATIONS

  • EnumerationsAn enumeration is a user-defined integer type. When you declare an enumeration, you specify a set of acceptable values that instances of that enumeration can contain. Not only that, but you can give the values user-friendly names. If, somewhere in your code, you attempt to assign a value that is not in the acceptable set of values to an instance of that enumeration, the compiler will flag an error. Creating an enumeration can end up saving you lots of time and headaches in the long run. At least three benefits exist to using enumerations instead of plain integers:As mentioned, enumerations make your code easier to maintain by helping to ensure that your variables are assigned only legitimate, anticipated values.Enumerations make your code clearer by allowing you to refer to integer values by descriptive names rather than by obscure magic numbers.Enumerations make your code easier to type, too.

  • THANK YOU