Printf Statements
Printf statements offer a flexable way of displaying information to the screen (handyboard LCD in this case).
Syntax
- printf("statement");
- printf("statement",variable1, variable2, etc);
Special Characters
These items are included within the "statement" part of printf as formatting instructions.
Syntax | Description |
---|---|
\n | New Line, Clears the Handyboard Screen. |
%d | Displays the corresponding variable as a base 10 integer. |
%f | Displays the corresponding variable as a base 10 floating point number. |
The above table shows just a few commonly used examples. Feel free to browse the internet and discover other useful options.
Example
- void main()
- {
- int a;
- for(a=0; a < 5; a++)
- {
- printf("\nThe value of A is %d", a);
- a = a + 1;
- }
- for(a=4; a != 0; a = a - 1)
- printf("\nSince A=5, this will be printed");
- }