自定义一个函数,函数的参数为整型数组,返回类型也为整型。怎么定义啊!

解决方案 »

  1.   

    type
       MyIntArray = array of integer;var
       function TestFunc(intarray:MyIntArray) :integer;
      

  2.   

    不是这样的啊~我一开始就定义了这样几个数组,并初始化了这些数组:  HdrAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);
      TenAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);
      CenAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);现在要写一函数,把这些数组传给这个函数,现在定义函数的时候,都不知道定义里函数的参数怎么写!
      

  3.   

    我定如:function TestFunc(array[]:integer) :integer;提示出错啊!
      

  4.   

    定义完后有没有写这个function?
      

  5.   

    对了,我还没有定义,在声明的时候系统就提示出错哦~
    function TestFunc(array[]:integer) :integer;
      

  6.   

    借一楼的用一下了. -____-
    type
       MyIntArray = array of integer;var
       function TestFunc(intarrayA:MyIntArray;intarrayB:MyIntArray;intarrayC:MyIntArray) :integer;
    楼主啊,能做一个参数,就可以做多个参数啊........不过要注意参数的大小,不能太大啊.否则会引起栈溢出的.
    可是这样定义:
    type
       MyIntArray = array of integer;
       pMyIntArray =^MyIntArray ;
    var
       function TestFunc(intarrayA:pMyIntArray;intarrayB:pMyIntArray;intarrayC:pMyIntArray) :integer;
    传指针.
      

  7.   

    调用时:
      HdrAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);
      TenAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);
      CenAry:array[0..12]of Integer =  (0,0,0,0,0,0,0,0,0,0,0,0,0);type
       MyIntArray = array of integer;var
       function TestFunc(intarrayA:MyIntArray;intarrayB:MyIntArray;intarrayC:MyIntArray) :integer;TestFunc(HdrAry,TenAry,CenAry);type
       MyIntArray = array of integer;
       pMyIntArray =^MyIntArray ;
    var
       function TestFunc(intarrayA:pMyIntArray;intarrayB:pMyIntArray;intarrayC:pMyIntArray) :integer;var  pinta,pintb,pintc:pMyintarray;
         
    pinta:=@HdrAry[0];
    pintb:=@TenAry[0];
    pintc:=@CenAry[0];
    testfun(pinta,pintb,pintc);