Page 1 of 1

some NXC beginner questions

Posted: 13 Oct 2010, 09:40
by tobasco666
Hi,
Usaually I'm working with high-level-languages, therfore I run into some pitfalls when I start to work with NXC (BricxCC 3.3):

When I try to declare a multi-dim-array with initialization I get Errors: Variable name expected, ";" expected

Code: Select all

int matrix[][] = {{1, 2, 3}, {4, 5, 6}};
When I try to create a function which returns an int array I get Errors: ";" expected, ";" expected, ";" expected

Code: Select all

int foo[] (){
  int bar[] = {1,2,3};
  return bar;
}
It would be great if someone could enlighten me :roll:

salute
Thomas

Re: some NXC beginner questions

Posted: 13 Oct 2010, 15:58
by afanofosc
This code compiles fine with the latest official release of BricxCC and NBC/NXC.

Code: Select all

task main()
{
  int matrix[][] = {{1, 2, 3}, {4, 5, 6}};
  NumOut(0, LCD_LINE1, matrix[0][0]);
  Wait(SEC_5);
}
NXC currently does not support returning arrays of any kind from a user-defined function. Can you post a request to the NXC wish list thread if you would like to see this supported in a future release?

John Hansen