Operators
एक ऑपरेटर एक प्रतीक है। कंपाइलर ऑपरेटर की पहचान करता है और विशिष्ट गणितीय या तार्किक संचालन करता है। सी निम्नलिखित ऑपरेटरों को प्रदान करता है:
- Arithmetic Operators
 - Increment and Decrement Operators
 - Relational Operators
 - Logical Operators
 - Cast Operators
 - Bitwise Operators
 - Assignment Operators
 
Arithmetic Operators
* multiplication
/ division
% remainder after division (modulo arithmetic)
+ addition
- subtraction and unary minus
Increment and Decrement Operators
इंक्रीमेंट और डिक्रीमेंट ऑपरेटरों का उपयोग ऑप्रैंड के वर्तमान मूल्य से 1 जोड़ने या घटाने के लिए किया जाता है।
++ increment
-- decrement
इंक्रीमेंट और डिक्रीमेंट ऑपरेटर प्रीफिक्स या पोस्टफिक्स हो सकते हैं। उपसर्ग शैली में अभिव्यक्ति के परिणाम से पहले oprand का मान बदल जाता है और पोस्टफ़िक्स शैली में r के बाद चर को संशोधित किया जाता है
For eg.
a = 9;
b = a++ + 5; /* a=10 b=14 */
a = 3;
b = ++a + 6; /* a=10 b=15 */
Relational Operators
== equal.
!= Not equal.
> < Greater than/less than
>= greater than or equal to
<= less than or equal to
Logical Operators
&& Called Logical AND operator. If both the operands are non-zero, then condition becomes true.
|| Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true.
! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false.
Cast Operators
कास्ट ऑपरेटरों का उपयोग किसी मान को एक से दूसरे प्रकार में बदलने के लिए किया जाता है।
(float) sum; converts type to float
(int) fred; converts type to int
Bitwise Operators
बिटवाइज़ ऑपरेटर एक वेरिएबल के प्रत्येक बाइट में मौजूद वास्तविक बिट्स पर ऑपरेशन करते हैं। प्रत्येक बाइट में 8 बिट होते हैं, प्रत्येक बिट 0 या 1 के मान को स्टोर कर सकता है
~ one's complement
& bitwise AND
^ bitwise XOR
| bitwise OR
<< left shift (binary multiply by 2)
>> right shift (binary divide by 2)
Assignment Operators
= assign
+= assign with add
-= assign with subtract
*= assign with multiply
/= assign with divide
%= assign with remainder
>>= assign with right shift
<<= assign with left shift
&= assign with bitwise AND
^= assign with bitwise XOR
|= assign with bitwise OR
For example,
a = a + 64; is same as
a += 64;
Download our app
Click on >> Download_app
0 टिप्पणियाँ