EasyC Variable Type

Hello Vex Forumers!

I was wondering, if you have a variable, and you want to know the type (example: unsigned char, char…) how do you find it out? Or does it really matter?


Double click on the “Variable” box at the top of the program. A popup will appear with a list of all the variables in that function, as well as their type, and initial value.

I’m sorry for the confusion, but what I meant was that when you create a variable, how do you know what type to put in? (examples are: char, unsigned char)

char’s are for sensors like bumper and limit switches
long’s are for encoders
int you can use for the speed of your motors

In EasyCv4, View menu, enable Project Explorer,
In Project Explorer side window, expand Header Files, open/view API.h

Example lines:

void SetMotor(unsigned char ucMotor, int iSpeed);
long GetEncoder(unsigned char ucPort);

This shows the expected variable type for each parameter.

void means no variable; ie dont do Var = SetMotor( 1, 127);
I thought iSpeed was a signed char, since the range is -127 to 127, but apparently it is an int. Its not surprising that I learn by reseraching answers to questions.

EasyC tries to convert types for you most of the time, but it is good coding practice to know what is expected (as documented by API.h) and provide that.

Additionally, each sensor block states what kind of value it returns in parenthesis next to the “Retrieve to” dialog.