Pada Pertemuan kedua kami mempelajari mengenai operator dan operand.
Opeartor ada simbol yang digunakan untuk menghitung sperti
+,-,*,/,%. Sedangkan Operand adalah angka yang akan dimanipulasi.

C=A+B
‘+’ disini berfungsi sebagai operator
Operator dibagi menjadi tiga:
Unary operator : hanya butuh satu operand
Contoh: C!
Binary operator : butuh dua operand
Contoh: A+B
Trinary operator: butuh tiga operand
Tipe-tipe Operator

Assignment : =
Logical : &&, ||, !, ^
Arithmatic : +, -, *, /, %, ++, –, (), pow [pangkat]
Relational : ==, !=, <, >, <=, >=, ?: cth [?:] if (a>b) z=a;  Else z=b;     —> z=(a>b) ?a :b;
Bitwise (yang dioperasikan bitna) : &, |, ^, ~, >>, <<
Pointer

Berikut adalah contoh simbol logical operator:
Symbol && adalah AND, | | adalah OR, dan ! adalah NOT.

A             TRUE    TRUE   FALSE   FALSE
B             TRUE   FALSE   TRUE   FALSE
!A            FALSE   FALSE   TRUE   TRUE
A&&B    TRUE   FALSE   FALSE   FALSE
A | | B     TRUE   TRUE   TRUE   FALSE

Leave a Reply