Created
February 5, 2023 00:50
-
-
Save LucianoPAlmeida/deb57714d3bf6484e77bc9412b850c76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void printI(int &i) { | |
std::cout << "s" << i << std::endl; // Use of deallocated memory crash or maybe just garbage. | |
} | |
int main(int argc, const char * argv[]) { | |
int *i = new int(); | |
// Pretend this was deleted by mistake in a non-obvious way. | |
delete i; | |
printI(*i); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment