如题,C代码如下。
typedef struct tagRS_BLOCKINFO
{
int ncRSBlock;
int ncAllCodeWord;
int ncDataCodeWord;
} RS_BLOCKINFO, *LPRS_BLOCKINFO;
typedef struct tagQR_VERSIONINFO
{
int nVersionNo;   
int ncAllCodeWord; 
int ncDataCodeWord[4];
int ncAlignPoint;
int nAlignPoint[6]; RS_BLOCKINFO RS_BlockInfo1[4];
RS_BLOCKINFO RS_BlockInfo2[4];} QR_VERSIONINFO, *LPQR_VERSIONINFO;数组如下
static QR_VERSIONINFO QR_VersonInfo[] = {{0}, // (Ver.0)
 { 1, // Ver.1
    26,   19,   16,   13,    9,
   0,   0,   0,   0,   0,   0,   0,
   1,  26,  19,
   1,  26,  16,
   1,  26,  13,
   1,  26,   9,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0},
 { 2, // Ver.2
    44,   34,   28,   22,   16,
   1,  18,   0,   0,   0,   0,   0,
   1,  44,  34,
   1,  44,  28,
   1,  44,  22,
   1,  44,  16,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0},
 { 3, // Ver.3
    70,   55,   44,   34,   26,
   1,  22,   0,   0,   0,   0,   0,
   1,  70,  55,
   1,  70,  44,
   2,  35,  17,
   2,  35,  13,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0,
   0,   0,   0}}这是数组的一部分。。 数组太大。小弟试了很久,初始化这边总报错。。

解决方案 »

  1.   

    看看你寫的Delphi數組以及報錯信息
      

  2.   

    type RS_BLOCKINFO = ^tagRS_BLOCKINFO;
      tagRS_BLOCKINFO = record
        ncRSBlock : Integer;
        ncAllCodeWord : Integer;
        ncDataCodeWord : Integer;
      end;
    type QR_VERSIONINFO = ^tagQR_VERSIONINFO;
      tagQR_VERSIONINFO = record
        nVersionNo : Integer;
        ncAllCodeWord : Integer;
        ncDataCodeWord:array[0..4] of Integer;
        ncAlignPoint : Integer;
        nAlignPoint :array[0..6] of Integer;
        RS_BlockInfo1:array[0..4] of RS_BLOCKINFO;
        RS_BlockInfo2:array[0..4] of RS_BLOCKINFO;
      end;
    QR_VersonInfo:array[0..39] of QR_VERSIONINFO = ( (0),
              ((1); // Ver.1
       (26);
              (19;16;13;9),
              (0),
              (0;0;0;0;0;0)
              (1;26;19),
              (1;26;16),
              (1;26;13),
              (1;26;9),
    (0;  0;   0),
    (0;   0;   0),
    (0;   0;   0),
    (0;   0;   0))大概是这样
      

  3.   

    type QR_VERSIONINFO = ^tagQR_VERSIONINFO; 
      tagQR_VERSIONINFO = record 
        nVersionNo : Integer; 
        ncAllCodeWord : Integer; 
        ncDataCodeWord:array[0..3] of Integer; 
        ncAlignPoint : Integer; 
        nAlignPoint :array[0..5] of Integer; 
        RS_BlockInfo1:array[0..3] of RS_BLOCKINFO; 
        RS_BlockInfo2:array[0..3] of RS_BLOCKINFO; 
      end; 
      

  4.   

    主要是数组初始化的时候报错。。
    [Error] QR_Encode.pas(8): ')' expected but ',' found
    [Error] QR_Encode.pas(9): Incompatible types: 'Integer' and 'QR_VERSIONINFO'
    [Error] QR_Encode.pas(10): ')' expected but ';' found
    [Fatal Error] QR_Encodeh.pas(88): Could not compile used unit 'QR_Encode'
    错误信息
      

  5.   

    int ncDataCodeWord[4];相当于delphi中的 ncDataCodeWord:array[0..3] of integer;而不是ncDataCodeWord:array[0..4] of integer;
    你把你的程序改一下
                                              
      

  6.   

    可以这样初始化,你参考一下
    ta=record
        s:  array[0..2] of integer;
        x: integer;
       end;
      
    a: array[0..1] of ta=((s:(2,1,3);x:3),(s:(1,2,3);x:0));
      

  7.   

    初始化数组应该放到const说明中才行。
      

  8.   

    方法太多了,干嘛拘泥于那个形式哦。
    不行就用最原始的方法好了,定义部分只是格式,然后用代码来初始化赋值进去不就得了。或者你在const部分赋值哦。