What is the difference between static_cast and reinterpret_cast? [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: When should static_cast, dynamic_cast and reinterpret_cast be used? I'm using c function in c++, where a structure passed as a void type argument in c is directly stored that same structure type. eg in C. void getdata(void *data){ Testitem *ti=data;//Testitem is of struct type. } to do the same in c++ i use static_cast: void foo::getdata(void *data){ Testitem *ti = static_cast<Testitem*>(data); } and when i use