SlideShare uma empresa Scribd logo
1 de 15
Variable declaration &
     initialization
• Declaration:
                                  int x;
                                 ↙ ↘
                     data type      identifier name
(for more than one variables separate them with commas)

• Initialization:
                                   x=9;
(value is stored )
• Declaration & initialization in one step:
             int x=9;
• = is an assignment operator
Int x,y=6,z=2;
x=y;             ////x=6
y=z;             ///y=2
z=x;            ///z=6
• Its associativity is right (it means right side of =(assignment
  operator )is evaluated first.)
Keywords/reserve words:
• Lower case letters
• E.g for,while,int,char,float
Variable:
• It can be modified. they are used to store constant values
• int→2 bytes        e.g 1,2,3 etc
• float → 4 bytes        e.g 1.1,2.3 etc
• char →1 byte         e.g A,S,D, 1 ,2,3, +,*,& etc
#include<iostream.h>
main()
{
cout<<“hello” ;
}
Operators
• Is anything that perform some action on some variable or constant
1.Unary operators
2.Binary operators
3.Arithmatic operators
1.Unary operators:
++, -- ,+ , -
They increment the value by 1.
(a)Unary minus operator:-
It is used to reverse the sign of a value.it makes a +ve value to –ve value and
     vice versa.e.g
int a, b;
a=87;
b=-a;
It has higher precedence over binary operator.
1.Increment operator:
(A)Prefix increment:
b=++a
a=a+1
b=a

(B)postfix increment:
b=a++
b=a
a=a+1
2.Decrement operator:
(A)Prefix decrement:
--y
b=--a
a=a-1
b=a
(B) postfix decrement:
b=a--
b=a
a=a-1

2.Binary operators:
• The operators that operate on two data items.
• E.g multiplication etc
3.Arithmatic operators: +, - ,* ,/ , %
• Remainder operator :modulus
Order of precedence
•   * , / ………………….left to right
•   + , - ………………….left to right
•   ( ) parenthesis ………………….left to right
•   Parenthesis within parenthesis(innermost first)
•   1+2+3-4+5
•   7+c*d/c
•   a/b/c
•   2+a/b*5
•   6+12/6*2-1
Type casting:
Conversion of one data type of numeric value to
  another
1.Implicit type casting
2.Explicit type casting
Arithmatic expressions:
2(a+b) →2*(a+b)
5/9(F-32) →5/9*(F-32)
Assignment operators: =
• Variable=expression
int a, b, c
a=200 ,b=100
c=a;
a=b;
b=c;
• Compound assignment:
  x=y=6;
Relational operator:
• Also called comparison operator
• After comparing two variables or expressions results into 0
  /1 or true /false
• ==
• !=
• <
• <=
• >
• >=
Logical operator:
1. and operator && (.)
2. or operator || (+)
3. not operator ! (-)
Conditional operator:
• It consists of “?” and “:”.
• Its syntax is
 {condition}?{exp1}:{exp2}
Where
Condition…..represents test condition
Exp1 & exp2….represents two expressions which
  may be arithmetic expression or constant value.
Sizeof operator:
void main()
{
int x;
cout<<sizeof(x);
}

2

Mais conteúdo relacionado

Mais procurados

Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional arrayRajendran
 
Chapter27 polymorphism-virtual-function-abstract-class
Chapter27 polymorphism-virtual-function-abstract-classChapter27 polymorphism-virtual-function-abstract-class
Chapter27 polymorphism-virtual-function-abstract-classDeepak Singh
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayimtiazalijoono
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : ArraysGagan Deep
 
Introduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaIntroduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaDmytro Mitin
 
Testing in the World of Functional Programming
Testing in the World of Functional ProgrammingTesting in the World of Functional Programming
Testing in the World of Functional ProgrammingLuka Jacobowitz
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppteShikshak
 
QuickCheck - Software Testing
QuickCheck - Software TestingQuickCheck - Software Testing
QuickCheck - Software TestingJavran
 
Monoids, monoids, monoids
Monoids, monoids, monoidsMonoids, monoids, monoids
Monoids, monoids, monoidsLuka Jacobowitz
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional arrayRajendran
 
Principled Error Handling with FP
Principled Error Handling with FPPrincipled Error Handling with FP
Principled Error Handling with FPLuka Jacobowitz
 

Mais procurados (20)

Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Arrays
ArraysArrays
Arrays
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Chapter27 polymorphism-virtual-function-abstract-class
Chapter27 polymorphism-virtual-function-abstract-classChapter27 polymorphism-virtual-function-abstract-class
Chapter27 polymorphism-virtual-function-abstract-class
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
Introduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaIntroduction to programming with dependent types in Scala
Introduction to programming with dependent types in Scala
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Testing in the World of Functional Programming
Testing in the World of Functional ProgrammingTesting in the World of Functional Programming
Testing in the World of Functional Programming
 
Lecture17 arrays.ppt
Lecture17 arrays.pptLecture17 arrays.ppt
Lecture17 arrays.ppt
 
Lab 13
Lab 13Lab 13
Lab 13
 
Arrays
ArraysArrays
Arrays
 
QuickCheck - Software Testing
QuickCheck - Software TestingQuickCheck - Software Testing
QuickCheck - Software Testing
 
Array in C
Array in CArray in C
Array in C
 
Monoids, monoids, monoids
Monoids, monoids, monoidsMonoids, monoids, monoids
Monoids, monoids, monoids
 
Multi dimensional array
Multi dimensional arrayMulti dimensional array
Multi dimensional array
 
Sigma type
Sigma typeSigma type
Sigma type
 
Templates
TemplatesTemplates
Templates
 
Principled Error Handling with FP
Principled Error Handling with FPPrincipled Error Handling with FP
Principled Error Handling with FP
 

Destaque

Surface stresses..............................
Surface stresses..............................Surface stresses..............................
Surface stresses..............................Umer Warraich
 
4 pump 03 reciprocating pump
4 pump 03 reciprocating pump4 pump 03 reciprocating pump
4 pump 03 reciprocating pumpRefee Lubong
 
reciprocating pumps
reciprocating pumps  reciprocating pumps
reciprocating pumps THE ROCK
 
Reciprocating pumps
Reciprocating pumpsReciprocating pumps
Reciprocating pumpssumitnp369
 
Reciprocating pump pdf
Reciprocating pump pdfReciprocating pump pdf
Reciprocating pump pdfSourav Jana
 

Destaque (6)

Surface stresses..............................
Surface stresses..............................Surface stresses..............................
Surface stresses..............................
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
4 pump 03 reciprocating pump
4 pump 03 reciprocating pump4 pump 03 reciprocating pump
4 pump 03 reciprocating pump
 
reciprocating pumps
reciprocating pumps  reciprocating pumps
reciprocating pumps
 
Reciprocating pumps
Reciprocating pumpsReciprocating pumps
Reciprocating pumps
 
Reciprocating pump pdf
Reciprocating pump pdfReciprocating pump pdf
Reciprocating pump pdf
 

Semelhante a Lec2+lec3

2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++Aahwini Esware gowda
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c languagetanmaymodi4
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c languageTanmay Modi
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
 
C++ revision add on till now
C++ revision add on till nowC++ revision add on till now
C++ revision add on till nowAmAn Singh
 
C++ revision add on till now
C++ revision add on till nowC++ revision add on till now
C++ revision add on till nowAmAn Singh
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssionseShikshak
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
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
 
C++ process new
C++ process newC++ process new
C++ process new敬倫 林
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data TypesRavi Shankar
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructionsLearn By Watch
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsYashJain47002
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming NeedsRaja Sekhar
 

Semelhante a Lec2+lec3 (20)

2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++
 
Operators
OperatorsOperators
Operators
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Operators inc c language
Operators inc c languageOperators inc c language
Operators inc c language
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
What is c
What is cWhat is c
What is c
 
C++ revision add on till now
C++ revision add on till nowC++ revision add on till now
C++ revision add on till now
 
C++ revision add on till now
C++ revision add on till nowC++ revision add on till now
C++ revision add on till now
 
3.Loops_conditionals.pdf
3.Loops_conditionals.pdf3.Loops_conditionals.pdf
3.Loops_conditionals.pdf
 
C language basics
C language basicsC language basics
C language basics
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
 
SPL 6 | Operators in C
SPL 6 | Operators in CSPL 6 | Operators in C
SPL 6 | Operators in C
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.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
 
C++ process new
C++ process newC++ process new
C++ process new
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data Types
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questions
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
Lec19
Lec19Lec19
Lec19
 

Mais de Umer Warraich (20)

Lec03
Lec03Lec03
Lec03
 
Hydraulic actuator 2003
Hydraulic actuator 2003Hydraulic actuator 2003
Hydraulic actuator 2003
 
Hydraulic fluids(03336275386)
Hydraulic fluids(03336275386)Hydraulic fluids(03336275386)
Hydraulic fluids(03336275386)
 
Hydrauilc systems
Hydrauilc systemsHydrauilc systems
Hydrauilc systems
 
Soldering 2
Soldering 2Soldering 2
Soldering 2
 
Brazing
BrazingBrazing
Brazing
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Lecture 10 copy
Lecture  10   copyLecture  10   copy
Lecture 10 copy
 
Tig welding
Tig weldingTig welding
Tig welding
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Mig
MigMig
Mig
 
Mig
MigMig
Mig
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Mig
MigMig
Mig
 
7th lec welding
7th lec   welding7th lec   welding
7th lec welding
 
Sheet metal 3
Sheet metal 3Sheet metal 3
Sheet metal 3
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 

Último

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Lec2+lec3

  • 1. Variable declaration & initialization
  • 2. • Declaration: int x; ↙ ↘ data type identifier name (for more than one variables separate them with commas) • Initialization: x=9; (value is stored )
  • 3. • Declaration & initialization in one step: int x=9; • = is an assignment operator Int x,y=6,z=2; x=y; ////x=6 y=z; ///y=2 z=x; ///z=6
  • 4. • Its associativity is right (it means right side of =(assignment operator )is evaluated first.) Keywords/reserve words: • Lower case letters • E.g for,while,int,char,float Variable: • It can be modified. they are used to store constant values • int→2 bytes e.g 1,2,3 etc • float → 4 bytes e.g 1.1,2.3 etc • char →1 byte e.g A,S,D, 1 ,2,3, +,*,& etc
  • 6. Operators • Is anything that perform some action on some variable or constant 1.Unary operators 2.Binary operators 3.Arithmatic operators 1.Unary operators: ++, -- ,+ , - They increment the value by 1. (a)Unary minus operator:- It is used to reverse the sign of a value.it makes a +ve value to –ve value and vice versa.e.g int a, b; a=87; b=-a; It has higher precedence over binary operator.
  • 7. 1.Increment operator: (A)Prefix increment: b=++a a=a+1 b=a (B)postfix increment: b=a++ b=a a=a+1 2.Decrement operator: (A)Prefix decrement: --y b=--a a=a-1 b=a
  • 8. (B) postfix decrement: b=a-- b=a a=a-1 2.Binary operators: • The operators that operate on two data items. • E.g multiplication etc 3.Arithmatic operators: +, - ,* ,/ , % • Remainder operator :modulus
  • 9. Order of precedence • * , / ………………….left to right • + , - ………………….left to right • ( ) parenthesis ………………….left to right • Parenthesis within parenthesis(innermost first) • 1+2+3-4+5 • 7+c*d/c • a/b/c • 2+a/b*5 • 6+12/6*2-1
  • 10. Type casting: Conversion of one data type of numeric value to another 1.Implicit type casting 2.Explicit type casting Arithmatic expressions: 2(a+b) →2*(a+b) 5/9(F-32) →5/9*(F-32)
  • 11. Assignment operators: = • Variable=expression int a, b, c a=200 ,b=100 c=a; a=b; b=c;
  • 12. • Compound assignment: x=y=6; Relational operator: • Also called comparison operator • After comparing two variables or expressions results into 0 /1 or true /false • == • != • < • <= • > • >=
  • 13. Logical operator: 1. and operator && (.) 2. or operator || (+) 3. not operator ! (-)
  • 14. Conditional operator: • It consists of “?” and “:”. • Its syntax is {condition}?{exp1}:{exp2} Where Condition…..represents test condition Exp1 & exp2….represents two expressions which may be arithmetic expression or constant value.
  • 15. Sizeof operator: void main() { int x; cout<<sizeof(x); } 2