User manual

ASURO - 58
-
C for ASURO
Declaration of variables may be provided as global variable outside the main()-function or as a
local variable inside the main()-function. Global variables will be valid in the complete program
area. Local variables will be valid inside the main()-function or any other function only. They will
be valid for the programming code inside the function and they will be invalid outside the function.
Variables are rather useless, as long as we are unable to  ll them with data. Assigning data is
however rather easy:
a=17; // variable a contains a value 17
or alternatively in a calculation:
a=17+23; // variable a contains a value 40
Speed=a+3; // variable Speed contains a value 43
Speed=Speed*2; // variable Speed contains a value 86
It is good programming practice to use clear understandable names. The variable name “speed” in
this example is self-explainable. Using simple letters as a variable should be restricted as it often
results in “unreadable” programming code.
The following example may demonstrate a simple, complete programming source:
#include “asuro.h”
int main(void) {
int i; // i may contain numbers between -32768 and 32767
char any_token; // variable any_token may contain ASCII-symbols or
// numbers between -128 and 127
i=3;
any_token =17+i; // any_token will now be assigned 20
i=i/2; // Division by 2, will always be rounded down
// therefore i will now be assigned 1!
return 0;
}
A few interesting shortcuts are useful in the programming language C, e.g.:
i=i+1;
may also be written as:
i++;
Equally:
i=i-1;
may be written as:
i--;