Pass addresses for the first two parameters in the statement giving you
problems:
        matchRec = alFindRecNum(&keyElems[k], &Values[j][k], Sizes[j][k],
RecNums[k]);
You were passing values, not pointers.  I didn't look at the rest of your
code, but you may want to check this throughout.

Regards,

Steve

-----Original Message-----
From: Rob Graber [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 20, 2000 11:24 AM
To: Palm Developer Forum
Subject: Arrays and Pointers issue - HELP!!


I am messing with some pointers and multidimensional arrays, and I belive I
am following K&R, but CodeWarrior is balking at me.  Any ideas what my
problem is?  Sample code is below...I have stripped out all of the code
except the declarations and the function definitions...

The errors I get keep saying:

Error   : pointer/array required
Main.c line 973     matchRec = alFindRecNum(keyElems[k], Values[j][k],
Sizes[j][k], RecNums[k]);

Error   : cannot convert
'short * (*)[7]' to
'short **'
Main.c line 1242             pTbl, tmpRow, curElem, keyElems);

//Sample Code
static Int alFindRecNum(ElementType *keyElem, IntPtr Values, Int Size, Int
startRec)
{
        return 0;
}

static Boolean alGetKey(Int j, Int k, Int NumKeyElems, IntPtr Values[], Int
Sizes[],
                                Int RecNums[], TABLE_REC *pTbl, WORD tmpRow,
ElementType *curElem,
                                ElementType *keyElems[] )
{
        Int matchRec;

        matchRec = alFindRecNum(keyElems[k], Values[j][k], Sizes[j][k],
RecNums[k]);

        return alGetKey(j, k+1, NumKeyElems, Values, Sizes, RecNums,
                                 pTbl, tmpRow, curElem, keyElems);
}

static Boolean BuildReferences()
{

        ElementType     *curElem;
        ElementType *keyElems[7];
        Int i,j,k,m,x;
        WORD    tmpRow, tblIndex;
        TABLE_REC       *pTbl;
        Int             numRecs;
        UInt    recordIndex;
        ULong   CurPosValues, CurPosStrings, CurPosOffsets;
        ULong CurPosKeys[6];
        Int             ValuesSize, valColumn, descColumn;
        IntPtr  Keys[7][7], Values[7][7];
        Int             Sizes[7][7];
        Int             NumKeyElems;
        Int             RecNums[7];
        Err             err;

        if (curElem->KeyElemNums[1] != 0)
                alGetKey(j, k, NumKeyElems, Values, Sizes, RecNums,
                         pTbl, tmpRow, curElem, keyElems);


        return true;

}


-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to