PocketC Language
The Title
The Global Variables
The Functions
Expressions
Assignment
Operators
String Character Accessor
Increment / Decrement
Automatic Conversion and Casting
Statements
Statement Examples
Pointers
Include
Using Native Libraries
Special characters
Preprocessor
First, PocketC is a case sensitive language, meaning that typing word is not the same as type Word.
There are three elements to a PocketC applet: the title line, the global variables, and the functions.
The Title
The title is by far the easiest part of the PocketC language. The first line of your applet is two slashes followed by the name of your applet. Example:
// My Applet
This is also known as a comment. Anytime the compiler finds '//' in your applet, it will ignore the rest of the line that it is on. This allows you to place explanatory text in your applet. There is one other way to put a comment in your applet, by surrounding the text with '/* */'. This method allows you to spread a comment out over several lines. Example:
/* This is a multi-line comment.
All the text between the
asterisks is ignored */
Multi-line comments are not nestable. In other words:
/* comment1 /* comment2 */ a=b+c; */
is NOT valid.
The Global Variables
Variables are the things that are used to store values in a program. There are four types of variables in PocketC:
TypeNameExampleinteger (32-bit, signed)int1, 2, 5, -789, 452349floating point (32-bit)float-1.2, 3.141592, 5.7e-4characters (8-bit, signed)char'a', 'b', '#'stringsstring"Bob" "Katie" "Hello"pointerspointerdiscussed laterNote: String constants may only be 1023 characters. To strore a longer string in a variable, use addition: str = "long1..." + "long2...";
Variables are declared like this:variable-type name[,name...];
Here are a few examples:
int myInteger, row, column;
string name;
float pi;
char c, last, first;
pointer ptr;
It is also possible to have an array of values. An array is a list of values that