Intuitive C is a programming language that can be used to develop Intuitive Media Applications. It is similar to the original C language, so if you are familiar with programming in C, you will feel comfortable using Intuitive C.
C Syntax int i; |
int i = 4; |
enum
keyword,
is a type designed to represent values across a series of named constants.
Each of the enumerated constants has type int.
An enumerated type is declared with the enum
specifier, a name for the enum,
and a list of one or more constants contained within curly braces and separated by commas.
By default, the first constant in an enumeration is assigned value
zero, and each subsequent value is incremented by one over the previous
constant. Specific values may also be assigned to constants in the
declaration, and any subsequent constants without specific values will
be given incremented values from that point onward. enum Colors { RED, GREEN, BLUE = 4, YELLOW }; |
Colors paint; |
enum Colors
type, the int
constants RED
whose value is zero, GREEN
whose value is one, BLUE
whose value is four,
YELLOW
whose value is five and the enum Colors
variable paint.
float f; |
float g = 1.72; |
int array [100]; |
array
to hold 100
values of the primitive type int.
i
- indexed element of array,
the syntax would be array [i]; |
int array [3][4]; |
array [1][2]; |
int array1 [2] = { 10, 20 }; |
float array2 [2][4] = { { 1.0, 2.0 }, { 3.0, 4.0 } }; |
struct
keyword.
The specifier keyword is followed by an identifier name, which is used to identify the form of the structure.
The identifier is followed by the declaration of the structure's body:
a list of member declarations, contained within curly braces, with each declaration terminated by a semicolon.
For example, the following statement declares a structure named MyStruct
that contains two members:
struct MyStruct { |
int i; |
float f; |
}; |
s
as an instance of structure MyStruct.
MyStruct s; |
MyStruct s = { 10, 20.0 }; |
Operators | Description | Direction |
() | Function call | Left to right |
[] | Array subscripting | Left to right |
. | Element selection | Left to right |
- | Unary minus | Right to left |
* / | Multiplication and division | Left to right |
< <= > >= | Less, Less or equal, Greater, Greater or equal | Left to right |
== != | Equal, Not equal | Left to right |
= | Assignment | Right to left |
+= -= | Assignment by addition and subtraction | Right to left |
%= /= | Assignment by multiplication and division | Right to left |
Operator name | Syntax | Valid types |
Addition | a + b | int, float |
Assignment by addition | a += b | int, float |
Unary minus | -a | int, float |
Subtraction | a - b | int, float |
Assignment by subtraction | a -= b | int, float |
Multiplication | a * b | int, float |
Assignment by multiplication | a *= b | int, float |
Division | a / b | int, float |
Assignment by division | a /= b | int, float |
Operator name | Syntax | Valid types |
Less than | a < b | int, float |
Less than or equal to | a <= b | int, float |
Greater than | a > b | int, float |
Greater than or equal to | a >= b | int, float |
Not equal to | a != b | int, float |
Equal to | a == b | int, float |
Operator name | Syntax | Valid types |
Operator name | Syntax | Valid types |
Assignment | a = b | int, float |
Function call | a () | functions |
Array subscript | a [b] | arrays |
Member | a.b | structures |
{ |
<optional-declaration-list> |
<optional-statement-list> |
} |
if
statement has the following form: if (<expression>) |
<statement1> |
else |
<statement2> |
if
statement, if the <expression> in parentheses is nonzero (true),
control passes to <statement1>. If the else
clause is present
and the <expression> is zero (false), control will pass to <statement2>.
The else <statement2> part is optional, and if absent, a false <expression> will simply result
in skipping over the <statement1>.
An else
always matches the nearest previous unmatched if
;
braces may be used to override this when necessary, or for clarity. do |
<statement> |
while (<expression>); |
while (<expression>) |
<statement> |
for (<expression>; <expression>; <expression>) |
<statement> |
while
and do
statements, the substatement is executed repeatedly
so long as the value of the expression remains nonzero (true).
With while,
the test, including all side effects from the expression,
occurs before each execution of the statement; with do,
the test follows each iteration.
Thus, a do
statement always executes its substatement at least once,
whereas while
may not execute the substatement at all.for,
the statement for (e1; e2; e3) |
s; |
e1; |
while (e2) { |
s; |
e3; |
} |
continue;
statement
(which in the for loop jumps to e3
instead of e2
).
Any of the three expressions in the for
loop may be omitted.
A missing second expression makes the while
test always nonzero,
creating a potentially infinite loop.return
statement.
When return
is followed by an expression, the value is returned to the caller
as the value of the function. return; |
return a + b; |
return
statement:
<return-type> functionName (<parameter-list>) |
{ |
<statements> |
return <expression of type return-type>; |
} |
<parameter-list>
of N
variables is declared as data type and variable name separated by a comma:
<data-type> var1, <data-type> var2, ... <data-type> varN |