Page 1 of 1

Variable Bug

Posted: 05 Feb 2011, 02:34
by dudmaster
I have a problem this code:

Code: Select all

void Mapper(int FrontUltrasonic, int LeftUltrasonic, int RightUltrasonic, int CityMap[16][16])
{

}
task main()
{
}
And I think it is a bug.

This code works:

Code: Select all

void Mapper(int FrontUltrasonic, int LeftUltrasonic, int RightUltrasonic)
{

}
task main()
{
}

Re: Variable Bug

Posted: 05 Feb 2011, 03:35
by muntoo
You can't put those 16s in there. 42 is a different story...

Code: Select all

void Mapper(int CityMap[][], int FrontUltrasonic, int LeftUltrasonic, int RightUltrasonic)
{
    unsigned int CM_d1 = ArrayLen(CityMap);
    if(CM_d1 < 16)
        return;
    unsigned int CM_d2 = ArrayLen(CityMap[0]);
    if(CM_d2 < 16)
        return;

    // YOUR CODE HERE
}


task main()
{
    int buf[];
    int CityMap[][];
    ArrayInit(buf, NULL, 16);
    ArrayInit(CityMap, buf, 16);

    Mapper(CityMap, 0, 0, 0);
}

Re: Variable Bug

Posted: 05 Feb 2011, 17:05
by dudmaster
Thanks. This was for my friend's FLL project, but he got stuck on this code. I'll E-Mail him.

Re: Variable Bug

Posted: 07 Feb 2011, 21:25
by afanofosc
I'm pretty sure you can't use NXC in FLL. Unless they've changed the rules or something.

John Hansen