You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void* p = &d; // ok: address of any nonconst object can be stored in a void*// ok: converts void* back to the original pointer typedouble *dp = static_cast<double*>(p);
注意下文提及的一句话:
use a static_castto cast the pointer back to its original type
给出的答案如下:
但自己看书理解后做题,第二行考虑到_pc和i一个是char一个是int,和reinterpret_cast部分的例子差不多,感觉应该用reinterpret_cast。
而第四行考虑到是从pv的void_类型变到pc的char*类型,和static_cast给的第二个例子一样,感觉应该用static_cast。
不知道我理解上是否有误?
The text was updated successfully, but these errors were encountered: