Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • @Jim---I had tried that,bnut that didnt work out.The error jst sprang up that 1)conversion from enum Element4_Range*' to enum Element3_Range' Commented Apr 21, 2010 at 3:50
  • 4
    @maddy: Based on that error, you're trying to cast a pointer to an enum to an enum. You must have pasted the wrong code into this question. Is Target a pointer? Is Source? An enum is an integral value and you should be able to cast it. Commented Apr 21, 2010 at 3:53
  • @maddy are you running a compiler in C++ mode? for example, does your source file end with .cpp (rather than .c) and you are using gcc? You shouldn't see the error you report when using the suggested cast in C. Also, casting enums is not recommended -- although as you will see, it is possible. ;) Commented Apr 21, 2010 at 4:02
  • @Health..Yes i am running a c++ compiler.But I had jst tried using memcpy(Source,Target,10);which i guess worked fine.Any suggestion on this plz Commented Apr 21, 2010 at 4:24
  • @Maddy. No 'l' in my name... Regardless of whether you are able to call memcpy(), using a C++ compiler will affect your ability to use casts. Most C++ compilers have a C mode for compiling C. Which compiler are you using, and what is the extension of your source code file? Commented Apr 21, 2010 at 14:06