La Web del Programador: Comunidad de Programadores
 
    Pregunta:  28939 - MATRICES EN DINAMICA
Autor:  ezequiel careƱo
Necesito hacer una asignacion en una matriz que esta en memoria dinamica. Aparte la matriz tiene registros.
Me ayudaria un monton si me decis como se hace el type, el var y la asinacion.
Muchas Gracis

  Respuesta:  Roberto Garcia
type
puntero=^matriz;

registros=record;
nombre:strin[10];
edad:byte;
sexo:char;
end;

matriz=array[1..10,1..10] of registros;

var
p:puntero {variable que guardara la matriz}

begin
clrscr;
new(p) {se crea el espacio para la matriz}

p^[1,1].nombre:='Roberto';
p^[1,1].edad:=21;
p^[1,1].sexo:='m';

writeln( 'Nombre: ', p^[1,1].nombre);
writeln('Edad: ',p^[1,1].edad);
writeln('Sexo: ',p^[1,1].sexo);

readkey;
end.