Punctuators

The punctuators used in a User Language Program are

   
[ ] Brackets
( ) Parentheses
{ } Braces
, Comma
; Semicolon
: Colon
= Equal sign

Other special characters are used as operators in a ULP.

Brackets

Brackets are used in array definitions

int ai[];

in array subscripts

n = ai[2];

and in string subscripts to access the individual characters of a string

string s = "Hello world";
char c = s[2];

Parentheses

Parentheses group expressions (possibly altering normal operator precedence), isolate conditional expressions, and indicate function calls and function parameters:

d = c * (a + b);
if (d == z) ++x;
func();
void func2(int n) { ... }

Braces

Braces indicate the start and end of a compound statement:

if (d == z) {
   ++x;
   func();
   }

and are also used to group the values of an array initializer:

int ai[] = { 1, 2, 3 };

Comma

The comma separates the elements of a function argument list or the parameters of a function call:

int func(int n, real r, string s) { ... }
int i = func(1, 3.14, "abc");

It also delimits the values of an array initializer:

int ai[] = { 1, 2, 3 };

and it separates the elements of a variable definition:

int i, j, k;

Semicolon

The semicolon terminates a statement, as in

i = a + b;

and it also delimits the init, test and increment expressions of a for statement:

for (int n = 0; n < 3; ++n) {
    func(n);
    }

Colon

The colon indicates the end of a label in a switch statement:

switch (c) {
  case 'a': printf("It was an 'a'\n"); break;
  case 'b': printf("It was a  'b'\n"); break;
  default:  printf("none of them\n");
  }

Equal Sign

The equal sign separates variable definitions from initialization lists:

int i = 10;
char c[] = { 'a', 'b', 'c' };

It is also used as an assignment operator.