Getting 2 functions to run at the same time?

Unless the ROBOTC VM is doing something strange, declaring a function-local variable as


static

will (by the C/C++ standards, respectively) preserve their values between calls to the function they are declared in (IOW, their lifetimes are extended to the program’s lifetime).

What about the case here, where a method is passed a struct, and it is necessary for the values that are changed during that method to be preserved? What variable would be needed to be declared static?

In this case, I think the code you posted above is fine. Static locals would usually be used to preserve primitive values. For example, a task that continually polls an ultrasonic sensor might want to keep the last valid value in case the ultrasonic sensor times out.

I was speaking to “automatic” variables, not static.

Ah, thus my confusion.

That being said, I don’t see where


auto

variables we’re being discussed (indeed, does ROBOTC even support the


auto

type?)-- unless you meant something other than the type inference keyword from C++?

Ah I see, thank you.

However, I note that

Anyway, to avoid getting further off-topic: I believe the OP’s question was answered, no?