SQC supports the following arithmetic operators:
Example:
void main()
{
int
a = 10,
b = 5,
c;
/* sequoia supports the following arithmetic operators: */
c = a * b; // multiplication
c = a / b; // division
c = a % b; // mod (remainder division)
c = a + b; // addition
c = a - b; // subtraction
/* It also supports the following "increment" and "decrement" operators: */
++a; // pre increment
--a; // pre decrement
a++; // post increment
a--; // post decrement
/* Finally, it supports a set of bitwise operations: */
a = ~a; // bit complement
a = b << c; // shift b left by number of bits stored in c
a = b >> c; // shift b right by number of bits stored in c
a = b & c; // b AND c
a = b ^ c; // b XOR c
a = b | c; // b OR c
/* allows math operations to be performed in a shortcut fashion: */
a = a * b;
a = a / b;
a = a % b;
a = a + b;
a = a - b;
a = a << b;
a = a >> b;
a = a & b;
a = a ^ b;
a = a | b;
a *= b;
a /= b;
a %= b;
a += b;
a -= b;
a <<= b;
a >>= b;
a &= b;
a ^= b;
a |= b;
/* The relational operations : */
c = (a == b); // equals
c = (a != b); // not equals
c = (a < b); // less than
c = (a > b); // greater than
c = (a <= b); // less than or equals
c = (a >= b); // greater than or equals
/* This conditional operator is also known as the ternary operator. */
a = ( b < 2 ) ? b : 10;
/* There are similar logical operators: */
c = a!b; // logical NOT
c = a&&b; // logical AND
c = a||b; // logical OR
if(( a == 10 ) && ( b == 5 ))
{
printf("equal");
}
/* Finally, there is a "sizeof" operand that returns the size of a particular operand in bytes: */
printf ( "Size = %d\n", sizeof( int ) );
}