Use of enums in C?

Posted by maddy on Stack Overflow See other posts from Stack Overflow or by maddy
Published on 2010-04-21T03:44:29Z Indexed on 2010/04/21 3:53 UTC
Read the original article Hit count: 313

Filed under:
|

Hi all, Is there anyway by which we can copy one enum to another one?For eg:

     enum Element4_Range{a4=1,b4,c4,d4};
     enum Element3_Range{a3=1,b3,c3};
     enum Element3_Range Myarr3[10];
     enum Element4_Range Myarr4[10];

     enum Element3_Range MyFunc(Element4_Range);

     main()
     {
          MyFunc(Myarr4);
     }
     enum Element3_Range MyFunc(Element4_Range Target)
     {
           enum Element3_Range Source;
           Source = Target;-----------Is this possible?
      }
      If not can anyone please show me the way to copy the values of enum from one to
      another?

      I was getting an error while executing this like
     a) incompatible types in assignment of `Element3_Range*' to `Element3_Range[10]' 
     b)cannot convert `Element4_Range' to `Element3_Range' in assignment 

     Thanks and regards
     Maddy

© Stack Overflow or respective owner

Related posts about c

    Related posts about enums