SlideShare a Scribd company logo
Computer
Programming in C
Input-Output
Instructions in C
By : Rahul Sharma
Subscribe channel on YouTube
Follow us on Facebook
Input-Output
Instruction in C
Subscribe our YouTube channel
Follow us on Facebook
Operators
Example: 5 + 6
Operator
Operands
Operators
5 * 5 + 3
28 40
BODMAS Rule is not apply in C language.
Bitwise Operators
❑ There are six types of bitwise operators
➢ Bitwise ‘AND’ (&)
➢ Bitwise ‘OR’ (|)
➢ Bitwise ‘XOR’ or Exclusive OR (^)
➢ Bitwise ‘NOT’ (~)
➢ Right Shift (>>)
➢ Left Shift (<<)
Unary Operators
❑ +, - , ++, --, sizeof( ).
❑ Unary operators are operators those required only one
operand to perform operations.
Unary Operators
➢ -a, -b, -c; Negative
➢ +a, +b, +c ; Positive
➢ --a, --b,--c; Decrement Operator
➢ ++a,++b,++c : Increment Operator
Unary Operator: Use will only 1
operand
Binary Operator: Use will only 2 operand
Ternary Operator: Use will only 3
operand
Unary Operators
➢ ++(Increment Operator)
• Post Increment Operator(x++)
• Pre Increment Operator(++x)
➢ --(Decrement Operator)
• Post Decrement Operator(x--)
• Pre Decrement Operator(--x)
Bitwise Operators
➢ Bitwise AND (&)
➢ Bitwise OR ( | )
➢ Bitwise XOR or Exclusive OR (^)
➢ Bitwise NOT ~
➢ Bitwise Right shift >>
➢ Bitwise Left shift <<
Bitwise Operators
Bitwise AND(&) : This operator work on binary numbers .
Operand Operator Operand Output
0 & 0 0
0 & 1 0
1 & 0 0
1 & 1 1
Ex:
Int x;
X= 23 & 56;
56 = 0000 0000 0011 1000
23= 0000 0000 0001 0111
16 = 0000 0000 0001 0000
16
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
9 8 7 6 5 4 3 2 1 0
If Both true then
O/P will be true
Bitwise Operators
Bitwise OR(|) : This operator work on binary numbers .
Operand Operator Operand Output
0 | 0 0
0 | 1 1
1 | 0 1
1 | 1 1
Ex:
Int x;
X= 23 & 56
56 = 0000 0000 0011 1000
23 = 0000 0000 0001 0111
63 = 0000 0000 0011 1111
1+2+4+8+16+32=
63
2^9 2^
8
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
9 8 7 6 5 4 3 2 1 0
If one value is
true then O/P will
be true.
Bitwise Operators
Bitwise XOR(^) : This operator work on binary numbers . If Both
operands are same than output will be 0 if different then 1.
Operand Operator Operand Output
0 ^ 0 0
0 ^ 1 1
1 ^ 0 1
1 ^ 1 0
Ex:
Int x;
X= 23 & 56
56 = 0000 0000 0011 1000
23 = 0000 0000 0001 0111
= 0000 0000 0010 1111
1+2+4+8+32=47
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
9 8 7 6 5 4 3 2 1 0
Both should be
different to get
true value.
Bitwise Operators
Bitwise Right shift (>>) : This operator work on binary numbers .
Here we have to add 00 in left side
Ex:
Int x;
X= 56>>2
56 = 0000 0000 0011 1000
Step 1: = 0000 0000 0000 1110 00
2+4+8=14
2^9 2^8 2^7 2^6 2^
5
2^4 2^3 2^2 2^1 2^0
9 8 7 6 5 4 3 2 1 0
Bitwise Operators
Bitwise Left shift (<<) : This operator work on binary numbers .
Here we have to add 00 in right side
Ex:
Int x;
X= 56<<2
56 = 0000 0000 0011 1000
Step 1: 56 = 00 0000 0000 1110 0000
32+64+128=448
2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
9 8 7 6 5 4 3 2 1 0
Relational Operators
➢ <, >, <=,>= ( 1 )
➢ ==, != ( 2)
➢ Here priority of set-1 is greater than set-2.
➢ Relational Operators always Yields results either 0 or 1.
➢ Every Non-zero value is true and zero value is false
main()
{ int x;
clrscr();
x = 3>4;
printf(“%d”, x);
}
0
Ctrl+F9
Output :
Logical Operators
➢ NOT !
➢ And &&
➢ OR ||
❖ NOT !
▪ This an unary operator.
▪ Priority level is also same as unary operator.
▪ It inverts the truth value of statement .
▪ !T = F
▪ !F = T
Logical Operators
❖ NOT !
▪ This an unary operator.
▪ Priority level is also same as unary operator.
▪ It inverts the truth value of statement .
▪ !T = F
▪ !F = T
Logical Operators
❖ NOT !
▪ This an unary operator.
▪ Example:
main()
{ int x=5;
clrscr();
x = !x > 4; // 0>4==0
printf(“%d”, x);
}
0
Ctrl+F9
Output :
Logical Operators
❖ AND &&
▪ This an Binary operator.
▪ If both operand are non zero(true) then it becomes true.
Operand Operator Operand Output
F && F F
T && F F
T && F F
T && T T
Logical Operators
❖ AND &&
▪ This an Binary operator.
▪ Example: main()
{ int x=5, y;
clrscr();
y = x > 4 && x <10 ; // T && T==1
printf(“%d”, y);
}
1
Ctrl+F9
Output :
Logical Operators
❖ OR ||
▪ This an Binary operator.
▪ If any of the two operands is non-zero(true) then it becomes true.
Operand Operator Operand Output
F || F F
T || F T
T || F T
T || T T
Thank You
➢ For Detailed understanding,
Subscribe our channel on
You tube.
➢ Follow us on Facebook
✓ Page name : Digital Wave (
Link in Description Box)

More Related Content

What's hot

Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
Shobi P P
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
rricky98
 
The Ring programming language version 1.6 book - Part 21 of 189
The Ring programming language version 1.6 book - Part 21 of 189The Ring programming language version 1.6 book - Part 21 of 189
The Ring programming language version 1.6 book - Part 21 of 189
Mahmoud Samir Fayed
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
Manoj Tyagi
 
Basic c operators
Basic c operatorsBasic c operators
Basic c operators
Anuja Lad
 
Stack1
Stack1Stack1
Stack1
Iqrazb
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya
 
Operator of C language
Operator of C languageOperator of C language
Operator of C language
Kritika Chauhan
 
Python Basic Operators
Python Basic OperatorsPython Basic Operators
Python Basic Operators
Soba Arjun
 
2 2. operators
2 2. operators2 2. operators
2 2. operators웅식 전
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4
Rumman Ansari
 
175035-cse LAB-04
175035-cse LAB-04 175035-cse LAB-04
175035-cse LAB-04
Mahbubay Rabbani Mim
 
Faisal
FaisalFaisal
Faisal
Faisal Saeed
 
Python
PythonPython
Newton cotes method
Newton cotes methodNewton cotes method
Newton cotes method
Faisal Saeed
 

What's hot (19)

Operators in C/C++
Operators in C/C++Operators in C/C++
Operators in C/C++
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
 
Vcs5
Vcs5Vcs5
Vcs5
 
The Ring programming language version 1.6 book - Part 21 of 189
The Ring programming language version 1.6 book - Part 21 of 189The Ring programming language version 1.6 book - Part 21 of 189
The Ring programming language version 1.6 book - Part 21 of 189
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Basic c operators
Basic c operatorsBasic c operators
Basic c operators
 
Stack1
Stack1Stack1
Stack1
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
 
Operator of C language
Operator of C languageOperator of C language
Operator of C language
 
Python Basic Operators
Python Basic OperatorsPython Basic Operators
Python Basic Operators
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Functions
FunctionsFunctions
Functions
 
2 2. operators
2 2. operators2 2. operators
2 2. operators
 
C Programming Language Part 4
C Programming Language Part 4C Programming Language Part 4
C Programming Language Part 4
 
Working with IDE
Working with IDEWorking with IDE
Working with IDE
 
175035-cse LAB-04
175035-cse LAB-04 175035-cse LAB-04
175035-cse LAB-04
 
Faisal
FaisalFaisal
Faisal
 
Python
PythonPython
Python
 
Newton cotes method
Newton cotes methodNewton cotes method
Newton cotes method
 

Similar to 4. operators in c programming by digital wave

Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
Neeru Mittal
 
Operators
OperatorsOperators
Operators
Kamran
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statementsCtOlaf
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)jahanullah
 
Logical and Conditional Operator In C language
Logical and Conditional Operator In C languageLogical and Conditional Operator In C language
Logical and Conditional Operator In C language
Abdul Rehman
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
ManojKhadilkar1
 
power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"
sj9399037128
 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
Durgadevi palani
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
Mohammad Imam Hossain
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
Tanmay Modi
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
tanmaymodi4
 
Operators in java
Operators in javaOperators in java
Operators in java
yugandhar vadlamudi
 
Control statments in c
Control statments in cControl statments in c
Control statments in c
CGC Technical campus,Mohali
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
Anusuya123
 
Theory3
Theory3Theory3

Similar to 4. operators in c programming by digital wave (20)

Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Operators
OperatorsOperators
Operators
 
Java - Operators
Java - OperatorsJava - Operators
Java - Operators
 
Java 2
Java 2Java 2
Java 2
 
Operators expressions-and-statements
Operators expressions-and-statementsOperators expressions-and-statements
Operators expressions-and-statements
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Logical and Conditional Operator In C language
Logical and Conditional Operator In C languageLogical and Conditional Operator In C language
Logical and Conditional Operator In C language
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
 
power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"power point presentation on topic in C++ called "OPERATORS"
power point presentation on topic in C++ called "OPERATORS"
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Control statments in c
Control statments in cControl statments in c
Control statments in c
 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
 
Theory3
Theory3Theory3
Theory3
 

Recently uploaded

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 

Recently uploaded (20)

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 

4. operators in c programming by digital wave

  • 1. Computer Programming in C Input-Output Instructions in C By : Rahul Sharma Subscribe channel on YouTube Follow us on Facebook
  • 2. Input-Output Instruction in C Subscribe our YouTube channel Follow us on Facebook
  • 3. Operators Example: 5 + 6 Operator Operands
  • 4. Operators 5 * 5 + 3 28 40 BODMAS Rule is not apply in C language.
  • 5. Bitwise Operators ❑ There are six types of bitwise operators ➢ Bitwise ‘AND’ (&) ➢ Bitwise ‘OR’ (|) ➢ Bitwise ‘XOR’ or Exclusive OR (^) ➢ Bitwise ‘NOT’ (~) ➢ Right Shift (>>) ➢ Left Shift (<<)
  • 6. Unary Operators ❑ +, - , ++, --, sizeof( ). ❑ Unary operators are operators those required only one operand to perform operations.
  • 7. Unary Operators ➢ -a, -b, -c; Negative ➢ +a, +b, +c ; Positive ➢ --a, --b,--c; Decrement Operator ➢ ++a,++b,++c : Increment Operator Unary Operator: Use will only 1 operand Binary Operator: Use will only 2 operand Ternary Operator: Use will only 3 operand
  • 8. Unary Operators ➢ ++(Increment Operator) • Post Increment Operator(x++) • Pre Increment Operator(++x) ➢ --(Decrement Operator) • Post Decrement Operator(x--) • Pre Decrement Operator(--x)
  • 9. Bitwise Operators ➢ Bitwise AND (&) ➢ Bitwise OR ( | ) ➢ Bitwise XOR or Exclusive OR (^) ➢ Bitwise NOT ~ ➢ Bitwise Right shift >> ➢ Bitwise Left shift <<
  • 10. Bitwise Operators Bitwise AND(&) : This operator work on binary numbers . Operand Operator Operand Output 0 & 0 0 0 & 1 0 1 & 0 0 1 & 1 1 Ex: Int x; X= 23 & 56; 56 = 0000 0000 0011 1000 23= 0000 0000 0001 0111 16 = 0000 0000 0001 0000 16 2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 9 8 7 6 5 4 3 2 1 0 If Both true then O/P will be true
  • 11. Bitwise Operators Bitwise OR(|) : This operator work on binary numbers . Operand Operator Operand Output 0 | 0 0 0 | 1 1 1 | 0 1 1 | 1 1 Ex: Int x; X= 23 & 56 56 = 0000 0000 0011 1000 23 = 0000 0000 0001 0111 63 = 0000 0000 0011 1111 1+2+4+8+16+32= 63 2^9 2^ 8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 9 8 7 6 5 4 3 2 1 0 If one value is true then O/P will be true.
  • 12. Bitwise Operators Bitwise XOR(^) : This operator work on binary numbers . If Both operands are same than output will be 0 if different then 1. Operand Operator Operand Output 0 ^ 0 0 0 ^ 1 1 1 ^ 0 1 1 ^ 1 0 Ex: Int x; X= 23 & 56 56 = 0000 0000 0011 1000 23 = 0000 0000 0001 0111 = 0000 0000 0010 1111 1+2+4+8+32=47 2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 9 8 7 6 5 4 3 2 1 0 Both should be different to get true value.
  • 13. Bitwise Operators Bitwise Right shift (>>) : This operator work on binary numbers . Here we have to add 00 in left side Ex: Int x; X= 56>>2 56 = 0000 0000 0011 1000 Step 1: = 0000 0000 0000 1110 00 2+4+8=14 2^9 2^8 2^7 2^6 2^ 5 2^4 2^3 2^2 2^1 2^0 9 8 7 6 5 4 3 2 1 0
  • 14. Bitwise Operators Bitwise Left shift (<<) : This operator work on binary numbers . Here we have to add 00 in right side Ex: Int x; X= 56<<2 56 = 0000 0000 0011 1000 Step 1: 56 = 00 0000 0000 1110 0000 32+64+128=448 2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 9 8 7 6 5 4 3 2 1 0
  • 15. Relational Operators ➢ <, >, <=,>= ( 1 ) ➢ ==, != ( 2) ➢ Here priority of set-1 is greater than set-2. ➢ Relational Operators always Yields results either 0 or 1. ➢ Every Non-zero value is true and zero value is false main() { int x; clrscr(); x = 3>4; printf(“%d”, x); } 0 Ctrl+F9 Output :
  • 16. Logical Operators ➢ NOT ! ➢ And && ➢ OR || ❖ NOT ! ▪ This an unary operator. ▪ Priority level is also same as unary operator. ▪ It inverts the truth value of statement . ▪ !T = F ▪ !F = T
  • 17. Logical Operators ❖ NOT ! ▪ This an unary operator. ▪ Priority level is also same as unary operator. ▪ It inverts the truth value of statement . ▪ !T = F ▪ !F = T
  • 18. Logical Operators ❖ NOT ! ▪ This an unary operator. ▪ Example: main() { int x=5; clrscr(); x = !x > 4; // 0>4==0 printf(“%d”, x); } 0 Ctrl+F9 Output :
  • 19. Logical Operators ❖ AND && ▪ This an Binary operator. ▪ If both operand are non zero(true) then it becomes true. Operand Operator Operand Output F && F F T && F F T && F F T && T T
  • 20. Logical Operators ❖ AND && ▪ This an Binary operator. ▪ Example: main() { int x=5, y; clrscr(); y = x > 4 && x <10 ; // T && T==1 printf(“%d”, y); } 1 Ctrl+F9 Output :
  • 21. Logical Operators ❖ OR || ▪ This an Binary operator. ▪ If any of the two operands is non-zero(true) then it becomes true. Operand Operator Operand Output F || F F T || F T T || F T T || T T
  • 22. Thank You ➢ For Detailed understanding, Subscribe our channel on You tube. ➢ Follow us on Facebook ✓ Page name : Digital Wave ( Link in Description Box)