Thread: enumeration

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    22

    Question enumeration

    enum hello {a, b, c, d, e};

    Over here a = 0, b = 1, c = 2 etc....

    Question:
    Is it possible to declare an enum number other than integer like float or double?

    If it is float, 'a' should be 0.0 and b = 1.0 ......

  2. #2
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Thumbs up

    Try assigning the values. If it takes them then u r through. else thats the only way...

    try
    enum hello (a=1.1, b=2.2);


    Try it.

    Regards,
    Sriharsha.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > Is it possible to declare an enum number other than integer like
    > float or double?

    No. Enumerations are integral values only, just like 'case' values.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Understanding/Implementing Enumeration
    By Iconate in forum C Programming
    Replies: 15
    Last Post: 10-10-2008, 09:16 AM
  2. Enumeration Issues
    By cdn_bacon in forum C++ Programming
    Replies: 5
    Last Post: 05-03-2007, 02:26 PM
  3. Enumeration problem
    By baniakjr in forum C++ Programming
    Replies: 8
    Last Post: 11-11-2006, 02:32 PM
  4. Having trouble implementing enumeration.
    By RP319 in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2005, 07:03 PM
  5. enumeration
    By C-Struggler in forum C Programming
    Replies: 5
    Last Post: 03-13-2003, 09:36 AM