Ver Mensaje Individual
  #1  
Antiguo 28-12-2015
JuanOrtega JuanOrtega is offline
Miembro
NULL
 
Registrado: sep 2011
Posts: 130
Reputación: 13
JuanOrtega Va por buen camino
Practica de arrays

Hola estoy practicando con los arrays normales en delphi , no con stringlist ni nada parecido.

Este el codigo que tengo :

Código Delphi [-]
type
  otro_array = array of string;

function clean_array(array1: otro_array): otro_array;
var
  array_limpio: otro_array;
  i: integer;
begin
  For i := Low(array1) to High(array1) do
  begin
    ShowMessage(array1[i]);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
const
  datos: array [1 .. 5] of string = ('test1', 'test2', 'test3',
    'test4', 'test5');
var
  arrays: Array Of String;
  i: integer;
begin

  SetLength(arrays, 5);

  arrays[0] := 'test1';
  arrays[1] := 'test2';
  arrays[2] := 'test3';
  arrays[3] := 'test4';
  arrays[4] := 'test5';

  clean_array(datos);
  clean_array(arrays);

Iba todo bien haciendolo solo , hasta que me aparecieron dos errores que no se como resolver.

En la linea
Código Delphi [-]
 clean_array(datos);
me devuelve este error :

Cita:
Incompatible types: 'otro_array' and 'Array'
En la linea
Código Delphi [-]
clean_array(arrays);
me devuelve este error :

Cita:
Incompatible types: 'otro_array' and 'Dynamic array'
En tema es que no se como resolverlo , no se si tengo que convertirlo o en realidad no se puede hacer lo que intento con estos dos arrays.

¿ Alguien me podria ayudar ?
Responder Con Cita