It causes undefined behaviour. Anything can happen. In practice, a runtime crash is probably what I’d expect.
More Related Contents:
- Avoid memory leaks in C++ Pointers [closed]
- C++ Memory Leak Using char *
- Why does the use of ‘new’ cause memory leaks?
- What do I need to do before deleting elements in a vector of pointers to dynamically allocated objects?
- How does dereferencing of a function pointer happen?
- Dynamically allocating an array of objects
- What is the size of a pointer?
- Why are function pointers and data pointers incompatible in C/C++?
- How many levels of pointers can we have?
- Are memory leaks “undefined behavior” class problem in C++?
- Passing references to pointers in C++
- Can a pointer to base point to an array of derived objects?
- Check if a pointer points to allocated memory on the heap
- Modifying a char *const string
- Weird Behaviour with const_cast [duplicate]
- Reason why not to have a DELETE macro for C++
- Is the “one-past-the-end” pointer of a non-array type a valid concept in C++?
- Pointer interconvertibility vs having the same address
- About Pointers To Functions in function declarations
- How to print member function address in C++
- Why do linked lists use pointers instead of storing nodes inside of nodes
- Why do some people prefer “T const&” over “const T&”?
- how do arrays work internally in c/c++
- Understanding -Weffc++
- Why is a c++ reference considered safer than a pointer?
- Safety of casting between pointers of two identical classes?
- How can a char pointer be initialized with a string (Array of characters) but an int pointer not with an array of integer? [duplicate]
- Does ‘auto’ type assignments of a pointer in c++11 require ‘*’?
- Is it possible to have a pointer literal?
- Pass by pointer & Pass by reference [duplicate]