Variable Bug

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
dudmaster
Posts: 171
Joined: 06 Oct 2010, 02:38
Location: Texas, Santa Fe
Contact:

Variable Bug

Post 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()
{
}
2Labz.com, My Website
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: Variable Bug

Post 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);
}
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
dudmaster
Posts: 171
Joined: 06 Oct 2010, 02:38
Location: Texas, Santa Fe
Contact:

Re: Variable Bug

Post by dudmaster »

Thanks. This was for my friend's FLL project, but he got stuck on this code. I'll E-Mail him.
2Labz.com, My Website
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Variable Bug

Post by afanofosc »

I'm pretty sure you can't use NXC in FLL. Unless they've changed the rules or something.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests