Enum values doubts?

Posted by maddy on Stack Overflow See other posts from Stack Overflow or by maddy
Published on 2010-04-16T11:17:14Z Indexed on 2010/04/16 11:23 UTC
Read the original article Hit count: 358

Filed under:
|

Hi all,

     Is there any possible way to do any arithmetic operations on enum values


      enum Type{Zero=0,One,Two,Three,Four,Five,Six,Seven,Eight,Nine};

       main()
       {
           enum Type Var = Zero;

           for(int i=0;i<10;i++)
           {
               switch(Var)
               {
                    case Zero:
                          /*do something*/
                    case One:
                          /*Do something*/

                      .....


               }
              Var++;(I know that this increment is not possible,But is there anyway by which we can have this variable named Var increment.

         regards
         maddy

© Stack Overflow or respective owner

Related posts about c

    Related posts about enum