ROBOTC.net forums
http://www.robotc.net/forums/

Passing arrays in robotc 3.65
http://www.robotc.net/forums/viewtopic.php?f=11&t=12574
Page 1 of 1

Author:  Asim Poptani [ Sat Nov 21, 2015 2:31 am ]
Post subject:  Passing arrays in robotc 3.65

I am attempting to pass an array of a struct to a function and assigning a variable to store it. However this has not been working (the secondary array struct is empty). Any help explaining this would be greatly appreciated.

Code:
struct {
  tMotor tmotor;
  int speed;
  int reversed;
} tMotorArray;


tMotorArray array2[3];// secondary struct

void test(tMotorArray array)
{
   array2=array;
}


task main()
{

tMotorArray array[3];

   array[0].tmotor=port1;
   array[0].speed=127;
   array[0].reversed=false;


test(array[3]);
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/