Created
November 4, 2012 21:34
-
-
Save leopic/4013877 to your computer and use it in GitHub Desktop.
Prueba de borrado de punteros
This file contains 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
#include <iostream>; | |
using namespace std; | |
int main() { | |
int miVar, | |
*miPuntero; | |
miVar = 8; | |
miPuntero = &miVar; | |
cout << "Posicion de memoria: " << miPuntero << endl; | |
miPuntero = new int; | |
delete miPuntero; | |
cout << "miPuntero: " << miPuntero << endl; // imprime direccion en memoria | |
miPuntero = NULL; | |
delete miPuntero; | |
cout << "miPuntero: " << miPuntero << endl; // imprime cero | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment