Operators in C Programming in Hindi

इस tutorial में हम C Programming Operators के बारे में बात करेंगे लेकिन उससे पहले हम Expressions और Operands को समझेंगे क्योंकि ये दोनों terms इस tutorial में बहुत बार use होंगी.

Expressions in C Programming in Hindi

C Programming में expression variables, constants और operators का combination होता है जिसे c language के syntax को follow करके लिखा जाता है.

सभी C language expression को evaluate करके उसके result value को किसी variable में assign किया जाता है. मैंने नीचे expression के examples दिए हैं.

x = a * b - c
y = b + c * a
z = a - b * c + d;

Operands in C Programming in Hindi

Operators और Operands दोनों एक जैसे words लगते हैं इसलिए कुछ programmer को लगता है की ये दोनों एक ही term है लेकिन real में ऐसा नहीं है.

अपने program में किसी भी operation को process करने के लिए operator के साथ जो values, variables या constants use होते है उन्हें हम operands कहते हैं. आइये नीचे दी गयी expression से समझते हैं.

c = a+b;

ऊपर दी गयी expression में c, a और b operands हैं इनके अलावा = और + operators हैं. 

What are Operators in C Programming in Hindi?

Operators के बिना कोई भी programming language अधूरी है क्योंकि शायद ही ऐसा कोई computer program होता होगा जिसमें operators का use नहीं होता हो.

C programming में operators special symbols होते हैं जिनका meaning और use पहले से fix होता है. Operators का use हम अपने C programs में specific mathematical or logical operations (task) को perform करने के लिए करते हैं.

C Programming Language में भी आपको बहुत types के operators मिल जाते हैं जिसने से आप अलग-अलग काम कर सकते हो.

Types of Operators

  • Arithmetic Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators
  • Conditional Operators or Ternary Operators
  • Increment and Decrement Operators
  • Bitwise Operators

Operators क्या होते हैं ये तो आप समझ ही गये और अब operators types को एक-एक करके details में समझेंगे.

Arithmetic Operators

Arithmetic Operators से तो आप पहले से ही familiar है क्योंकि बचपन से ही हम addition (+), subtraction (-), multiplication (*), division (/) and modulus (%) करते आये हैं.

नीचे दी गयी table देखकर ही आपको arithmetic operators की basic information मिल जाएगी लेकिन मैं आपको suggest करूँगा की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Arithmetic Operators in C Programming in Hindi

Arithmetic Operators
Operator Name Description
+ Addition Operands को जोड़ने के लिए
Subtraction Operands को घटाने के लिए
* Multiplication Operands में गुणा करने के लिए
/ Divide Operands में भाग देने के लिए
% Modulus Operands में भाग देकर शेषफल निकालने के लिए

Assignment Operators

जैसा की हमने ऊपर पढ़ा की arithmetic operators का use mathematical operations के लिए किया जाता है 

Arithmetic operators की help से mathematical expression को evaluate (solve) करके उसके result को किसी variable में assign करने के लिए assignment operators का use किया जाता है.

Assignment operator ( = ) right side वाली value, variable, constant या expression के result value को left side वाले variable में assign (copy) कर देता है.

नीचे दी गयी table और example देखकर ही आपको assignment operators की basic information मिल जाएगी लेकिन मैं आपको suggest करूँगा की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Assignment Operators in C Programming in Hindi

Assignment Operators
Operator Name Description
= Simple Assignment Right side values या expression को solve करके left side के variable में value assign करने के लिए
+= Addition Assignment Left और Right side values (variable) को जोड़कर left side के variable में assign करने के लिए
-= Subtraction Assignment Left और Right side values (variable) को घटाकर left side के variable में assign करने के लिए
*= Multiplication Assignment Left और Right side values (variable) को गुणा करके left side के variable में assign करने के लिए
/= Division Assignment Left और Right side values (variable) को भाग देकर left side के variable में assign करने के लिए
%= Modulo Assignment Left और Right side values (variable) को भाग देकर शेषफल left side के variable में assign करने के लिए

Relational Operators

Relational operators का use 2 values की relationship को compare करने के किया जाता है. अगर relationship गलत (false) है तो ये operators 0 return करते हैं और सही (true) होने पर non-zero integer number return करते हैं.

नीचे दी गयी table और example देखकर ही आपको relational operators की basic information मिल जाएगी लेकिन मैं आपको suggest करूँगा की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Relational Operators in C Programming in Hindi

Relational Operators
Operator Name Description
== Equal to जब दोनों operands की values बराबर होती है तब True return होगा.
!= Not Equal to जब दोनों operands की values अलग-अलग होती है तब True return होगा.
< Less than जब left operand की value right operand की value से कम होती है तब True return होगा.
> Greater than जब left operand की value right operand की value से ज्यादा होती है तब True return होगा.
<= Less than or equal to जब left operand की value right operand की value से कम या बराबर होती है तब True return होगा.
>= Greater than or equal to जब left operand की value right operand की value से ज्यादा या बराबर होती है तब True return होगा.

Logical Operators

जैसा की आपने ऊपर पढ़ा की relational operators का use conditions define करने के लिए किया जाता है.

कभी-कभी हमें अपने programs में एक से अधिक conditions को एक साथ define करना होता जो की एक-दूसरे से relate होती है और इसके लिए हम logical operators का use करते हैं.

Logical Operators सभी conditions के result values (true, false) को examine करने के बाद false यानी 0 और true यानी को non-zero integer number return करता है.

नीचे दी गयी table और example देखकर ही आपको logical operators की basic information मिल जाएगी लेकिन मैं आपको suggest करूँगा की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Logical Operators in C Programming in Hindi

Logical Operators
Operator Name Description
&& AND जब सभी conditions true होंगी तब True return होगा.
|| OR जब सभी conditions में से अगर एक भी condition true होगी तब True return होगा.
! NOT ये condition के result को reverse कर देता है यानी true को false और false को true.

Conditional Operator

Conditional operator का use हम if-else statement की तरह ही decision making में करते हैं. आप ऐसा भी कह सकते हैं की ये if-else की short form है.  

Conditional operator (ternary operator) में two symbols ( ? ) और ( : ) का use होता है. 

Question mark symbol ( ? ) से पहले condition आती है और उसके बाद true expression (statement) और Colon mark ( : ) के बाद false expression आता है.

(condition) ? true-expression : false-expression;

C Programs examples के साथ conditional operator की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Conditional Operator in C Programming in Hindi

Increment and Decrement Operators

Increment ( ++ )  और Decrement ( ) operators unary operator हैं यानी ये सिर्फ एक single variable के साथ ही use होते हैं.

Increment operator की help से variable की value में 1 number का increment हो जाता है और decrement operator की help से variable की value में 1 number का decrement हो जाता है.

x = x + 1 को आप ऐसे भी लिख सकते हैं ++x

x = x – 1 को आप ऐसे भी लिख सकते हैं –x

C Programs examples के साथ increment and decrement operators की detailed जानकारी के लिए आप नीचे दिए गये link पर क्लिक कर tutorial को अच्छे से जरूर पढ़ें.

Read: Increment and Decrement Operators in C Programming in Hindi

What’s Next: इस tutorial में हमने C Operators के बारे में पढ़ा. Next tutorial में हम C programming में Operators Precedence and Associativity का use करना सीखेंगे.