SlideShare a Scribd company logo
1 of 20
Operators in c programming
Name : Krishna kumar Pankaj
Roll No : 13/IT/22
What is Operators ?
 An operator is a symbol that is used to perform certain mathematical or
logical operations.
 Operator is used to manipulate data and variables.
Types of operators
 In C programming Operators classified in to various categories
 1. Arithmetic operators
 2. Relational operators
 3. Logical operators
 4. Assignment operators
 5. Increment & Decrement operators
 6. Conditional operators
 7. Bitwise operators
 8. Special operators
Arithmetic operators
 Arithmetic operators used to perform Arithmetic operations.
 There are following Arithmetic operators in c language
Example :
 #include<stdio.h>
#include<conio.h>
int main()
{
int x=25;
int y=5;
printf("%d+%d=%dn",x,y,x+y);
printf("%d-%d=%dn",x,y,x-y);
printf("%d*%d=%dn",x,y,x*y);
printf("%d/%d=%dn",x,y,x/y);
getch();
}
 Output :
25+5=30
25-5=20
25*5=125
25/5=5
Relational operators
 Relational operators compare between two operands and return in terms of
true or false
 There are following Relational operators.
Example :
#include<conio.h>
#include<stdio.h>
int main()
{
int a, b;
printf("Enter values for a and b : ");
scanf("%d%d",&a,&b);
printf("n The < value of a is %d", a<b);
printf("n The <= value of a is %d", a<=b);
printf("n The > value of a is %d", a>b);
printf("n The >= value of a is %d", a>=b);
printf("n The == value of a is %d", a==b);
printf("n The != value of a is %d", a!=b);
getch();
 }
Logical operator
 A Logical operator is used to compare or evaluate logical or relational
operations.
 There are following logical operators
Example :
#include<stdio.h>
#include<conio.h>
int main()
{
int a, b;
printf("Enter values for a and b : ");
scanf("%d%d", &a, &b);
printf("n %d",(a<b)&&(a!=b));
printf("n %d",(a<b)||(b<a));
printf("n %d",!(a==b));
getch();
}
Assignment operator
 An Assignment operator is used to assign a constant or a value of one
variable to another.
 = is an Assignment operator.
 you can use the assignment for multiple assignment as follows:
 x=y=z=20;
Increment Operator(++)
 Increment operator are increase the value of subsequent
 Increment operator are two types as follows:
• post Increment
• Ex : x=5;x++;x=5
• pre Increment
• x=5;++x;x=6
Decrement operator(--)
 Decrement operator Decrease the value to one ,two and so on.
 Decrement operator are also two type as
• Post Decrement
• x=5;x--;x=5
• pre decrement
• x=5;--x;x=4
Example of Increment & Decrement
operator
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter the values for a and b :");
scanf("%d%d", &a, &b);
printf("n The value of c is %d", c=++a);
printf("n The value of c is %d", c=a++);
printf("n The value of c is %d", c=--b);
printf("n The value of c is %d", c=b--);
}
 Output
Enter the value of a and b : 3 ,7
The value of c is 4
The value of c is 4
The value of c is 6
The value of c is 6
Conditional operator
 They are also called as ternary operator.
 They are also called as ?: operator.
 Ternary operator Takes on 3 Argument
Where
1) Expression 1 is condition
2) Expression2 is Statement Followed if Condition is True
3) Expression2 is Statement Followed if Condition is False
True
Condition ? Block 1 : Block 2
False
Example :
#include<stdio.h>
void main()
{
int a, b, x;
printf("Enter the values of a add b : ");
scanf("%d %d", &a, &b);
x=(a>b)?a:b;
printf("Biggest Value is :%d",x);
}
Bitwise Operator
 One of the C powerful Features is a set of bit manipulation operators
 There are various Bitwise Operators in C as following Table.
1. & (bitwise AND) Takes two numbers as operand and does AND on every bit of
two numbers. The result of AND is 1 only if both bits are 1.
2. | (bitwise OR) Takes two numbers as operand and does OR on every bit of two
numbers. The result of OR is 1 any of the two bits is 1.
3. ^ (bitwise XOR) Takes two numbers as operand and does XOR on every bit of
two numbers. The result of XOR is 1 if the two bits are different.
4. << (left shift) Takes two numbers, left shifts the bits of first operand, the
second operand decides the number of places to shift.
5. >> (right shift) Takes two numbers, right shifts the bits of first operand, the
second operand decides the number of places to shift.
6. ~ (bitwise NOT) Takes one number and inverts all bits of it
Special Operator
 There are many special operators use in c programming.
 Comma operator
 Sizeof Operator
Comma Operator
 Evaluate of comma operator – Left to Right
 Uses of comma operator as following :
 Multiples Declaration
 Multiples Initialization
 Multiples Variation
 Multiples Statement
 Example of comma operator
 X=12,y=10,z=18
 For( i=0,j=0;i<5,j<5;i++,j++ )
Sizeof operator
 Sizeof operator calculate the size of data
 i.e: How many bit a specific data having.
 Syntax of sizeof operator:
 Sizeof(variable);
Example :
sizeof(a), where a is interger, will return 4
Thank you
Any Queries ???
Go to Google Or
Email me at “Krishna.pankaj@hotmail.com”

More Related Content

What's hot

Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programmingprogramming9
 
Types of c operators ppt
Types of c operators pptTypes of c operators ppt
Types of c operators pptViraj Shah
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ LanguageWay2itech
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Deepak Singh
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in CPrabhu Govind
 
2. operators in c
2. operators in c2. operators in c
2. operators in camar kakde
 
Scope rules : local and global variables
Scope rules : local and global variablesScope rules : local and global variables
Scope rules : local and global variablessangrampatil81
 
Operators in java presentation
Operators in java presentationOperators in java presentation
Operators in java presentationkunal kishore
 
Presentation on function
Presentation on functionPresentation on function
Presentation on functionAbu Zaman
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programmingHarshita Yadav
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 

What's hot (20)

Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
 
Types of c operators ppt
Types of c operators pptTypes of c operators ppt
Types of c operators ppt
 
Variables in C and C++ Language
Variables in C and C++ LanguageVariables in C and C++ Language
Variables in C and C++ Language
 
Data types
Data typesData types
Data types
 
Operator.ppt
Operator.pptOperator.ppt
Operator.ppt
 
Chapter 5 - Operators in C++
Chapter 5 - Operators in C++Chapter 5 - Operators in C++
Chapter 5 - Operators in C++
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
 
Function Pointer
Function PointerFunction Pointer
Function Pointer
 
2. operators in c
2. operators in c2. operators in c
2. operators in c
 
Scope rules : local and global variables
Scope rules : local and global variablesScope rules : local and global variables
Scope rules : local and global variables
 
Operators in java presentation
Operators in java presentationOperators in java presentation
Operators in java presentation
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Presentation on pointer.
Presentation on pointer.Presentation on pointer.
Presentation on pointer.
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
C operator and expression
C operator and expressionC operator and expression
C operator and expression
 
data types in C programming
data types in C programmingdata types in C programming
data types in C programming
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 

Similar to Operators

B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2Tekendra Nath Yogi
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2Don Dooley
 
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.pptxManojKhadilkar1
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsAmrinder Sidhu
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdfMaryJacob24
 
Programming presentation
Programming presentationProgramming presentation
Programming presentationFiaz Khokhar
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de laLEOFAKE
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzationKaushal Patel
 

Similar to Operators (20)

Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptx
 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
 
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
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operators
 
additional.pptx
additional.pptxadditional.pptx
additional.pptx
 
Theory3
Theory3Theory3
Theory3
 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
 
C program
C programC program
C program
 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdf
 
Programming presentation
Programming presentationProgramming presentation
Programming presentation
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
C++
C++C++
C++
 
C++.pptx
C++.pptxC++.pptx
C++.pptx
 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operators
 
C-PPT.pdf
C-PPT.pdfC-PPT.pdf
C-PPT.pdf
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de la
 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
 

Recently uploaded

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 

Recently uploaded (20)

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 

Operators

  • 1. Operators in c programming Name : Krishna kumar Pankaj Roll No : 13/IT/22
  • 2. What is Operators ?  An operator is a symbol that is used to perform certain mathematical or logical operations.  Operator is used to manipulate data and variables.
  • 3. Types of operators  In C programming Operators classified in to various categories  1. Arithmetic operators  2. Relational operators  3. Logical operators  4. Assignment operators  5. Increment & Decrement operators  6. Conditional operators  7. Bitwise operators  8. Special operators
  • 4. Arithmetic operators  Arithmetic operators used to perform Arithmetic operations.  There are following Arithmetic operators in c language
  • 5. Example :  #include<stdio.h> #include<conio.h> int main() { int x=25; int y=5; printf("%d+%d=%dn",x,y,x+y); printf("%d-%d=%dn",x,y,x-y); printf("%d*%d=%dn",x,y,x*y); printf("%d/%d=%dn",x,y,x/y); getch(); }  Output : 25+5=30 25-5=20 25*5=125 25/5=5
  • 6. Relational operators  Relational operators compare between two operands and return in terms of true or false  There are following Relational operators.
  • 7. Example : #include<conio.h> #include<stdio.h> int main() { int a, b; printf("Enter values for a and b : "); scanf("%d%d",&a,&b); printf("n The < value of a is %d", a<b); printf("n The <= value of a is %d", a<=b); printf("n The > value of a is %d", a>b); printf("n The >= value of a is %d", a>=b); printf("n The == value of a is %d", a==b); printf("n The != value of a is %d", a!=b); getch();  }
  • 8. Logical operator  A Logical operator is used to compare or evaluate logical or relational operations.  There are following logical operators
  • 9. Example : #include<stdio.h> #include<conio.h> int main() { int a, b; printf("Enter values for a and b : "); scanf("%d%d", &a, &b); printf("n %d",(a<b)&&(a!=b)); printf("n %d",(a<b)||(b<a)); printf("n %d",!(a==b)); getch(); }
  • 10. Assignment operator  An Assignment operator is used to assign a constant or a value of one variable to another.  = is an Assignment operator.  you can use the assignment for multiple assignment as follows:  x=y=z=20;
  • 11. Increment Operator(++)  Increment operator are increase the value of subsequent  Increment operator are two types as follows: • post Increment • Ex : x=5;x++;x=5 • pre Increment • x=5;++x;x=6
  • 12. Decrement operator(--)  Decrement operator Decrease the value to one ,two and so on.  Decrement operator are also two type as • Post Decrement • x=5;x--;x=5 • pre decrement • x=5;--x;x=4
  • 13. Example of Increment & Decrement operator #include<stdio.h> #include<conio.h> int main() { int a,b,c; printf("Enter the values for a and b :"); scanf("%d%d", &a, &b); printf("n The value of c is %d", c=++a); printf("n The value of c is %d", c=a++); printf("n The value of c is %d", c=--b); printf("n The value of c is %d", c=b--); }  Output Enter the value of a and b : 3 ,7 The value of c is 4 The value of c is 4 The value of c is 6 The value of c is 6
  • 14. Conditional operator  They are also called as ternary operator.  They are also called as ?: operator.  Ternary operator Takes on 3 Argument Where 1) Expression 1 is condition 2) Expression2 is Statement Followed if Condition is True 3) Expression2 is Statement Followed if Condition is False True Condition ? Block 1 : Block 2 False
  • 15. Example : #include<stdio.h> void main() { int a, b, x; printf("Enter the values of a add b : "); scanf("%d %d", &a, &b); x=(a>b)?a:b; printf("Biggest Value is :%d",x); }
  • 16. Bitwise Operator  One of the C powerful Features is a set of bit manipulation operators  There are various Bitwise Operators in C as following Table. 1. & (bitwise AND) Takes two numbers as operand and does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1. 2. | (bitwise OR) Takes two numbers as operand and does OR on every bit of two numbers. The result of OR is 1 any of the two bits is 1. 3. ^ (bitwise XOR) Takes two numbers as operand and does XOR on every bit of two numbers. The result of XOR is 1 if the two bits are different. 4. << (left shift) Takes two numbers, left shifts the bits of first operand, the second operand decides the number of places to shift. 5. >> (right shift) Takes two numbers, right shifts the bits of first operand, the second operand decides the number of places to shift. 6. ~ (bitwise NOT) Takes one number and inverts all bits of it
  • 17. Special Operator  There are many special operators use in c programming.  Comma operator  Sizeof Operator
  • 18. Comma Operator  Evaluate of comma operator – Left to Right  Uses of comma operator as following :  Multiples Declaration  Multiples Initialization  Multiples Variation  Multiples Statement  Example of comma operator  X=12,y=10,z=18  For( i=0,j=0;i<5,j<5;i++,j++ )
  • 19. Sizeof operator  Sizeof operator calculate the size of data  i.e: How many bit a specific data having.  Syntax of sizeof operator:  Sizeof(variable); Example : sizeof(a), where a is interger, will return 4
  • 20. Thank you Any Queries ??? Go to Google Or Email me at “Krishna.pankaj@hotmail.com”