Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)
Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)
Handyboard and Kit Manual (A.K.A. - Botball Programming Guide)
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
© 2002 D.Miller, KIPR21Variables• Retain data for later use• Use in constructions such as arithmetic expressions• Must be declared before use at start of function (localvariables) or outside any function (global variables)– Syntax: – int i; [integer variable]– float x; [floating point variable]• To put a value in a variable:– Syntax: = – i = 2;– x = 2.0 * 1.5;– x = 3.2 * (float)i;© 2002 D.Miller, KIPR22Program Flow• When a program is run, the control moves fromone statement to the next• Be careful of 1 vs l (one vs ell)• Calculate j 2 + 1 when j = 3void main(){int r,j; /* declare r <strong>and</strong> j */j = 3; /* assign a value to j */r = j*j + 1; /* calculate <strong>and</strong> assign */printf(“result is %d\n”,r);}11