OrbWorks

PocketC for Palm OS - Language

Home   OrbForms Designer   PocketC Architect   [PocketC Palm OS]   PocketC CE   Other  

Overview
Language
Resources
Support Forum
Download
Purchase
 

 

Language

The PocketC language is easy to learn, and efficient to program with. PocketC is based on the syntax of C, but simplifies and extends it. To give you a quick impression, here is a brief introduction to the language. Complete documentation is available in the PocketC download.

Features

  • Five built-in data types: int, char, float, string, and pointer.
  • Supports all C statements: if, else, while, do, for, break, continue, switch, case, return
  • Simple pre-processor: #include, #define (no "function" macros), #ifdef, #else, #endif
  • All code is within functions
  • Program execution begins in the function named "main"

Example

As an example of what PocketC code looks like, the following is the source code to an application that draws the famous Sierpinsky's triangle.

// Triangle 
int tx[3], ty[3], x, y; 
main() {
   int i, r;
   tx[0] = 80;  ty[0] = 24;
   tx[1] = 10;  ty[1] = 150;
   tx[2] = 150; ty[2] = 150;
   r = random(3);
   x = tx[r]; y = ty[r];
   graph_on();
   title("Sierpinsky's Triangle");
   while (true) {
      r = random(3);
      x = (x + tx[r])/2;
      y = (y + ty[r])/2;
      line(1, x, y, x, y);
   }
}

Copyright (c) 1997-2023 OrbWorks