Operations with Expressions

Top  Previous  Next

The program supports all arithmetic and logical operations valid for the C language, as well as pointer and address operations:

 

Designation

Description

( )

Brackets (higher priority)

[ ]

Array component selector

.

Structure component or union selector

->

Selection of a structure component or a union addressed with a pointer

 

!

 

Logical negation

~

Bitwise inversion

-

Bitwise sign change

&

Returns address

*

Access by address

(type)

Explicit type conversion

(sizeof)

(returns size of operand, in bytes)

 

*

 

Multiplication

/

Division

%

Modulus operator (produces the remainder of an integer division)

+

Addition

-

Subtraction

 

<<

 

Left shift

>>

Right shift

 

<

 

Less than

<=

Less than or equal to

>

Greater than

>=

Greater than or equal to

==

Equal to

!=

Not equal to

 

&

 

Bitwise AND

^

Bitwise XOR

|

Bitwise OR

&&

Logical AND

||

Logical OR

=

Assignment

 

The types of operands are converted in accordance with the ANSI standard.

The results of logical operations are 0 (false) or 1 (true).

Allowed type conversions:

Operands can be converted to simple types (char, int, ... float).

Pointers can be converted to simple types (char *, int *, ... float *) and to structures or unions.

The word "struct" is not necessarily (MyStruct *).