1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Rep Power

    printing out the enum type.

    hi all
    i have declared num as enum type. num{ zero=0, one, ..}.

    num n1;

    how do i print out the enum type of n1, i.e, one not 1.

    thank in advance
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    You can't do that from the enum type.

    However, you can declare an array like this:
    char *array[] = {
    "two" ...
    n1 = one;
    printf ("%s", array[n1]);

    HTH :)
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo