C++ const void * 型別轉換簡單測試

double64發表於2024-09-22

這樣轉化是沒有問題的。

int a{ 100 };
const void *p = &a;
const int *pi = static_cast<const int *>(p);
cout << *pi << endl;

輸出:

100

相關文章