diff options
Diffstat (limited to '2023-2/L03/mitsuo')
| -rw-r--r-- | 2023-2/L03/mitsuo/fun.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/2023-2/L03/mitsuo/fun.cpp b/2023-2/L03/mitsuo/fun.cpp index 6f5fe0e..c3a4871 100644 --- a/2023-2/L03/mitsuo/fun.cpp +++ b/2023-2/L03/mitsuo/fun.cpp @@ -34,12 +34,14 @@ void lecturaDeProductos(const char *archivo, char ***&productos, int *&stocks, d } // memory allocation "por incrementos" - if (i == size) { + if (i + 1 >= size) { increase_size_productos(productos, stocks, precios, size); } productos[i] = crea_producto(code, description); // "code" is the "Primary Key" of the parallel arrays stocks[i] = qty; precios[i] = price; + + productos[i + 1] = NULL; /// last element of `productos` always points to NULL } } |
