Herunterladen Inhalt Inhalt Diese Seite drucken

Logische Operatoren Und Bitmanipulationen - Conrad Electronic C-Control II Station Handbuch

Inhaltsverzeichnis

Werbung

8. Die Programmiersprache C2

8.7.5 Logische Operatoren und Bitmanipulationen

In C2 sind logische Verknüpfungen immer Bitoperationen. Es wird nicht wie beispielsweise
in C/C++ in Bit-AND und logisches AND unterschieden.
Operator
Bedeutung
nicht (Bitinvertierung)
!
not
und
&
and
nand und mit anschließender Bitinvertierung
!&
oder
|
or
nor oder mit anschließender Bitinvertierung
!|
Beispielausdruck
!1
not 0
not 2.5
not 2.0
!(2 < 1)
!(1 < 2)
1 & 1
1 and 0
14 & 3
(1<2)&(2<3)
(1<2)&(3<2)
1 !& 1
1 nand 0
14 !& 3
(1<2)!&(2<3)
(1<2)!&(3<2)
1 | 1
1 or 0
0 or 0
14 or 1
(1<2)|(2<3)
(1<2)|(3<2)
(2<1)|(3<2)
1 !| 1
1 nor 0
0 nor 0
14 nor 1
(1<2)|(2<3)
(1<2)|(3<2)
(2<1)|(3<2)
Ergebnis
-2
-1
-0
-3
-1
0
1
0
2
-1
0
-2
-1
-3
0
-1
1
1
0
15
-1
-1
0
-2
-2
-1
-16
0
0
-1
61

Quicklinks ausblenden:

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis