X-Git-Url: https://git.llucax.com/z.facultad/75.31/presentacion.git/blobdiff_plain/6d7a6a64987f5160f7d457cd8f6311ffb0ba1281..a1aa0c314b9356e8f406d91a2da2d1adf47a754c:/ejemplos/nogc.d?ds=inline diff --git a/ejemplos/nogc.d b/ejemplos/nogc.d index 5df4667..83d3f07 100644 --- a/ejemplos/nogc.d +++ b/ejemplos/nogc.d @@ -3,9 +3,14 @@ import std.c.stdlib; int main() { int* p = cast(int*) malloc(4 * int.sizeof); // Nunca seran recolectados - p[3] = 1; + p[0] = 1; + p[1] = 11; + p[2] = 13; + p[3] = 17; + free(p); // libero + p = cast(int*) malloc(4 * int.sizeof); // No se inicializa for (uint i = 0; i < 4; ++i) printf("p[%d] = %d\n", i, p[i]); - free(p); + free(p); // liberoo se inicializa return 0; }