Last active
April 21, 2020 15:02
-
-
Save JimmyOlano/b092784d6cb0401c988f6bda2d06d43a to your computer and use it in GitHub Desktop.
Bestiario de una memoria mal gestionada (II)
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 <string.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
char *p1 = (char*)malloc(sizeof(char)*30); | |
memset(p1, '\0', 30); | |
memcpy(p1, "PRIMERA PRUEBA", 30); | |
printf("%s\n", p1); | |
free(p1); | |
char *p2 = (char*)malloc(sizeof(char)*30); | |
memset(p2, '\0', 30); | |
memcpy(p2, "SEGUNDA PRUEBA", 30); | |
free(p1); | |
printf("%s\n", p2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excelente artículo publicado por el sr. David García, quien (al escribir estas líneas) trabaja en ElevenPaths:
Bestiario de una memoria mal gestionada (II)