August 29th, 2003, 11:19 AM
-
printing out the enum type.
hi all
i have declared num as enum type. num{ zero=0, one, ..}.
num n1;
n1=one;
how do i print out the enum type of n1, i.e, one not 1.
thank in advance
August 29th, 2003, 11:28 AM
-
You can't do that from the enum type.
However, you can declare an array like this:
char *array[] = {
"zero",
"one",
"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