HTML Tutorials |
|
XML Tutorials |
|
Browser Scripting |
|
Server Scripting |
|
.NET (dotnet) |
|
Multimedia |
|
Web Building |
|
Java Tutorials |
|
Programming Langauges |
|
Soft Skills |
|
Database Tutorials |
|
Operating System |
|
Software Testing |
|
SAP Module |
|
Networking Programming |
|
Microsoft Office |
|
Accounting |
|
|
Descrizione degli operatori di C
|
Gli operatori di C entrano nelle seguenti categorie:
- Aggiungere alla fine gli operatori, che seguono un singolo operando soltanto.
- Operatori di prefisso costituiti da un solo elemento, che precedono con un singolo operando.
- Operatori binari, che prendono due operandi ed effettuano una variet� di funzionamenti logici ed aritmetici.
- L'operatore condizionale (un operatore ternario), che prende tre operandi e valuta la seconda o terza espressione, secondo la valutazione della prima espressione soltanto.
- Operatori di assegnazione, che assegnano soltanto un valore ad una variabile.
- L'operatore di virgola, che d� a garanzie la valutazione da sinistra a destra delle espressioni virgola-separate.
|
Per generare le espressioni pi� complesse, le variabili ed i costanti possono essere usati insieme con gli operatori di C. Le seguenti tabelle descrive gli operatori differenti disponibili in c
|
Operator |
Example |
Description/Meaning |
() |
f() |
Function call |
[] |
a[10] |
Array reference |
-> |
Structure and union member selection |
|
. |
s.a |
Structure and union member selection |
+ [unary] |
+a |
Value of a |
- [unary] |
-a |
Negative of a |
* [unary] |
*a |
Reference to object at address a |
& [unary] |
&a |
Address of a |
~ |
~a |
One's complement of a |
++ [prefix] |
++a |
The value of a after increment |
++ [postfix] |
a++ |
The value of a before increment |
- - [prefix] |
-a |
The value of a after decrement |
- - [postfix] |
a- |
The value of a before decrement |
sizeof |
sizeof (t1) |
Size in bytes of object with type t1 |
sizeof |
sizeof e |
Size in bytes of object having the type of expression e |
+ [binary]
- [binary]
* [binary]
/ % |
a + b
a - b
a * b
a / b
a % b |
a plus b
a minus b
a times b
a divided by b
Remainder of a/b |
>>
<< |
a >> b
a << b |
a, right-shifted b bits
a, left-shifted b bits |
<
>
<=
>=
==
!= |
a < b
a > b
a <= b
a >= b
a == b
a != b |
1 if a < b; 0 otherwise
1 if a > b; 0 otherwise
1 if a <= b; 0 otherwise
1 if a >= b; 0 otherwise
1 if a equal to b; 0 otherwise
1 if a not equal to b; 0 otherwise |
& [binary]
|
^ |
a & b
a | b
a ^ b |
Bitwise AND of a and b
Bitwise OR of a and b
Bitwise XOR (exclusive OR) of a and b |
&&
||
! |
a && b
a || b
!a |
Logical AND of a and b (yields 0 or 1)
Logical OR of a and b (yields 0 or 1)
Logical NOT of a (yields 0 or 1) |
?: |
a ? e1 : e2 |
Expression e1 if a is nonzero;
Expression e2 if a is zero |
=
+=
-=
*=
/=
%=
>>=
<<=
&=
|=
^=
, |
a = b
a += b
a -= b
a *= b
a /= b
a %= b
a >>= b
a <<= b
a &= b
a |= b
a ^= b
e1,e2 |
a, after b is assigned to it
a plus b (assigned to a)
a minus b (assigned to a)
a times b (assigned to a)
a divided by b (assigned to a)
Remainder of a/b (assigned to a)
a, right-shifted b bits (assigned to a)
a, left-shifted b bits (assigned to a)
a AND b (assigned to a)
a OR b (assigned to a)
a XOR b (assigned to a)
e2 (e1 evaluated first) |
|
Precedenza degli operatori di C
|
Category |
Operator |
Associativity |
Postfix |
() [] -> . ++ - - |
Left to right |
Unary |
+ - ! ~ ++ - - (type) * & sizeof |
Right to left |
Multiplicative |
* / % |
Left to right |
Additive |
+ - |
Left to right |
Shift |
<< >> |
Left to right |
Relational |
< <= > >= |
Left to right |
Equality |
== != |
Left to right |
Bitwise AND |
& |
Left to right |
Bitwise XOR |
^ |
Left to right |
Bitwise OR |
| |
Left to right |
Logical AND |
&& |
Left to right |
Logical OR |
|| |
Left to right |
Conditional |
?: |
Right to left |
Assignment |
= += -= *= /= %= >>= <<= &= ^= |= |
Right to left |
Comma |
, |
Left to right |
|
Keywords:
c operators,
c programming operators,
c bitwise operators,
c bit operators,
c language operators,
c binary operators,
c operator,
c++ operators'
'
operator in c,
c operator precedence,
operators in c,
operators c,
bitwise operators in c,
c# operators
|
|
HTML Quizes |
|
XML Quizes |
|
Browser Scripting Quizes |
|
Server Scripting Quizes |
|
.NET (dotnet) Quizes |
|
Multimedia Quizes |
|
Web Building Quizes |
|
Java Quizes |
|
Programming Langauges Quizes |
|
Soft Skills Quizes |
|
Database Quizes |
|
Operating System Quizes |
|
Software Testing Quizes |
|
SAP Module Quizes |
|
Networking Programming Quizes |
|
Microsoft Office Quizes |
|
Accounting Quizes |
|
|