相关代码 |
|
// Fig. 5.13: fig05_13.cpp // Attempting to modify a constant pointer to // non-constant data #include int main() { int x, y; int * const ptr = &x; // ptr is a constant pointer to an // integer. An integer can be modified // through ptr, but ptr always points // to the same memory location. *ptr = 7; ptr = &y; return 0; }
相关资源 |
|