Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/03/2013, 21:58
ElPatoGarrido
 
Fecha de Ingreso: noviembre-2011
Mensajes: 50
Antigüedad: 12 años, 5 meses
Puntos: 3
Pregunta [C++] Duda con new y delete o delete[]

Estaba investigando como hacer matrices dinamicas y en una parte lei que podia hacerlo con new, entonces yo lo implemente de esta forma.

Código C++:
Ver original
  1. void crearMatriz(int **m) {
  2.         for (i=0; i<n; i++)
  3.         m[i] = new int[n];
  4.  }
  5.  
  6. int main() {
  7.     int **matriz1;
  8.    
  9.     matriz1 = new int *[n];
  10.  
  11.         crearMatriz(matriz1);

El problema es que no se como hacer el delete correspondiente, ¿alguien me ayuda?.