C/C++, KDEVELOP

Basics

  1. Simple Types
  2. Strings
  3. Arrays and Structs
  4. Operators

Program Flow

Functions

Classes and Objects

X Window

KDevelop


-----------------
© Alfred Nussbaumer
Updated:
09 December 2021
-----------------

Operators

Operator Description
+, += Addition (a + b, arithmetic)
-, -= Subtraction (a - b, arithmetic)
*, *= Multiplication (a * b, arithmetic)
/, /= Division (a / b, arithmetic)
%, %= Modulus (a % b, arithmetic)
&& AND ((A > B) && (B > C), logical)
|| OR ((A < B) || (A < C), logical)
! NEGATION (!(A == B), logical)
== Equal (a == b, relational)
!= Not equal (a != b, relational)
<, <= Less than, Less than or equal (a <= b, relational)
>, >= Greater than, Greater than or equal (a > b, relational)
&, &= Bitwise AND
|, |= Bitwise inclusive OR
^, ^= Bitwise exclusive OR
<<, <<= Shift bits left
>>, >>= Shift bits right
~ Complement

Increment and Decrement Operators

Very popular operators are used to increment or decrement an operand.

j = i++
assigns to j the unchanged value of i and than adds 1 to i.
j = ++i
adds 1 to i and than assigns to j the incremented value of i.

You may use the decrement Operator -- in the same manner.

Shorthand Assignments

There exist more efficient statements for arithmetic and bitwise operators:

a = a + 15
equals
 a += 15


© Alfred Nussbaumer, Weblog "MiniNuss"