mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-03-20 20:05:07 +08:00
fix: add C-style cast for const pointer assignment
Fixes Light-City/CPlusPlusThings#362
This commit is contained in:
@@ -4,6 +4,6 @@ using namespace std;
|
||||
|
||||
int main(){
|
||||
const int p = 10;
|
||||
const void *vp = &p;
|
||||
void *vp = &p; //error
|
||||
// const void *vp = &p; // const pointer to const data
|
||||
void *vp = (void*)&p; // ✅ C-style cast
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user