Or you could just make 'm' an int pointer and then you don't have to cast. (Not to mention it makes more sense, is more clear in your code, and less error prone).
Why on Earth do you want to use void pointers here?
EDIT:
oh wait...
ust a homework to be familiar with void pointer.
*cringes*
Man... I really have to wonder wtf is up with some of these C++ courses.
I know it is more complex while using void* pointers. However, according to my prof, the main reason of using it is because the data type can be more general. In fact, you can choose not to use it. haha...
Unless you want the container to have non-homogeneous types, there is no reason to use a void* instead of templates. Your prof sounds like an old C hippie who has to teach a C++ course, because void* were very common in C because you didn't have templates but now their practical uses are very few and far between (in C++ programs).