Getting a dangling pointer by returning a pointer from a local C-style array – stackoverflow.com

I am a bit confused by the following code: #include <iostream> const char* f() { const char* arr[]={"test"}; return arr[0]; } int main() { auto x = f(); std::cout << x; ...

from Hot Questions - Stack Exchange OnStackOverflow
via Blogspot

Share this

Artikel Terkait

0 Comment to "Getting a dangling pointer by returning a pointer from a local C-style array – stackoverflow.com"