SlideShare a Scribd company logo
What is difference between Prefix & Postfix
(++i ,--i & i++ , i--)
So what is the difference????
Prefix Postfix
The ++ or -- symbol is
used before the variable.
The ++ or -- symbol is used
after the variable.
Example: ++i or --i Exmple i++ or i--
It means : i= i+1 or It means: i= i+1 or
i= i-1 i= i-1
It will be easy for u to understand these if u keep two things in
ur mind. That is :
In prefix : First increment / decrement by 1 then assign .
In postfix: First assign then increment/ decrement by 1 .
In prefix:
int i =5;
++i;
Output: 6
It works like:
i = ++i ; // First increment
= i+1;
= 5+1;
= 6;
int i = 6; // Then assign
Note:
In program the last & final value is accepted.
In postfix:
int i =5;
i++;
Output: 6
It works like:
int i = 5; // First assign
i =i++; // Then increment
= i+1;
= 5+1;
=6;
Note:
In program the last & final value is accepted.
**In prefix : First increment / decrement then assign**
If i and j are two variables then :
int i, j ;
i=9;
j=++i;
Output: i & j is : 10 10
Here, Compiler first add 1 to the initial value i=9. Then it
use the new incremented value in the same statement.
**In prefix : First assign then increment / decrement **
If i and j are two variables then :
int i, j ;
i=9;
j=i++;
Output: i & j is : 10 9
Try it yourself:
- -i & i- -
Hint: i = i -1;

More Related Content

What's hot

Tds on salaries
Tds on salariesTds on salaries
Tds on salaries
laxmankale99
 
E way bill_law_procedure_20_01_2018
E way bill_law_procedure_20_01_2018E way bill_law_procedure_20_01_2018
E way bill_law_procedure_20_01_2018
Vaibhav Jain
 
Ppt on tds
Ppt on tdsPpt on tds
Ppt on tds
Mudit Jain
 
TDS filing, E-filling of returns
TDS filing, E-filling of returnsTDS filing, E-filling of returns
TDS filing, E-filling of returns
SankalpNautiyal
 
E-Way Bill - GST in India
E-Way Bill - GST in IndiaE-Way Bill - GST in India
E-Way Bill - GST in India
CMA Md Rehan
 
Brief presentation on GSTR -2B along with screenshots from the GST Portal.
Brief presentation on GSTR -2B  along with screenshots from the GST Portal.Brief presentation on GSTR -2B  along with screenshots from the GST Portal.
Brief presentation on GSTR -2B along with screenshots from the GST Portal.
Ramandeep Bhatia
 
Advance tax tds and tcs
Advance tax tds and tcsAdvance tax tds and tcs
Advance tax tds and tcs
Sachidananda Singh Sanasam
 
Job work
Job workJob work
Job work
gst-trichy
 
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
Shiva Shankara
 
Tally ERP in ITT
Tally ERP in ITTTally ERP in ITT
Tally ERP in ITT
pillai college
 
Tds provisions [income tax act, 1961]
Tds provisions [income tax act, 1961]Tds provisions [income tax act, 1961]
Tds provisions [income tax act, 1961]
anmolgoyal1304
 
Concept of TDS and TCS and filing procedure.
Concept of TDS and TCS and filing procedure.Concept of TDS and TCS and filing procedure.
Concept of TDS and TCS and filing procedure.
Raushan (Kumar) Ray
 
Supply under GST (goods and services tax)
Supply under GST (goods and services tax)Supply under GST (goods and services tax)
Supply under GST (goods and services tax)
Aashi90100
 
GST RETURNS [ TAXATION ]
GST RETURNS [ TAXATION ]GST RETURNS [ TAXATION ]
GST RETURNS [ TAXATION ]
Rakshit Porwal
 
Digital Registers & Counters
Digital Registers & CountersDigital Registers & Counters
Digital Registers & Counters
university of education,Lahore
 
Presentation on advance tax
Presentation on advance taxPresentation on advance tax
Presentation on advance tax
Pooja Gupta
 
TDS OVERVIEW FOR FY 2019-20
TDS OVERVIEW FOR FY 2019-20TDS OVERVIEW FOR FY 2019-20
TDS OVERVIEW FOR FY 2019-20
Shiva prasad
 
Shift Register
Shift RegisterShift Register
Shift Register
Vanitha Chandru
 
TDS In Tally Erp 9
TDS In Tally Erp 9TDS In Tally Erp 9
TDS In Tally Erp 9
ravi78
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
michaelaaron25322
 

What's hot (20)

Tds on salaries
Tds on salariesTds on salaries
Tds on salaries
 
E way bill_law_procedure_20_01_2018
E way bill_law_procedure_20_01_2018E way bill_law_procedure_20_01_2018
E way bill_law_procedure_20_01_2018
 
Ppt on tds
Ppt on tdsPpt on tds
Ppt on tds
 
TDS filing, E-filling of returns
TDS filing, E-filling of returnsTDS filing, E-filling of returns
TDS filing, E-filling of returns
 
E-Way Bill - GST in India
E-Way Bill - GST in IndiaE-Way Bill - GST in India
E-Way Bill - GST in India
 
Brief presentation on GSTR -2B along with screenshots from the GST Portal.
Brief presentation on GSTR -2B  along with screenshots from the GST Portal.Brief presentation on GSTR -2B  along with screenshots from the GST Portal.
Brief presentation on GSTR -2B along with screenshots from the GST Portal.
 
Advance tax tds and tcs
Advance tax tds and tcsAdvance tax tds and tcs
Advance tax tds and tcs
 
Job work
Job workJob work
Job work
 
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
Guidance Note On Tax Audit Under Section 44 Ab Of The Income Tax Act, 1961
 
Tally ERP in ITT
Tally ERP in ITTTally ERP in ITT
Tally ERP in ITT
 
Tds provisions [income tax act, 1961]
Tds provisions [income tax act, 1961]Tds provisions [income tax act, 1961]
Tds provisions [income tax act, 1961]
 
Concept of TDS and TCS and filing procedure.
Concept of TDS and TCS and filing procedure.Concept of TDS and TCS and filing procedure.
Concept of TDS and TCS and filing procedure.
 
Supply under GST (goods and services tax)
Supply under GST (goods and services tax)Supply under GST (goods and services tax)
Supply under GST (goods and services tax)
 
GST RETURNS [ TAXATION ]
GST RETURNS [ TAXATION ]GST RETURNS [ TAXATION ]
GST RETURNS [ TAXATION ]
 
Digital Registers & Counters
Digital Registers & CountersDigital Registers & Counters
Digital Registers & Counters
 
Presentation on advance tax
Presentation on advance taxPresentation on advance tax
Presentation on advance tax
 
TDS OVERVIEW FOR FY 2019-20
TDS OVERVIEW FOR FY 2019-20TDS OVERVIEW FOR FY 2019-20
TDS OVERVIEW FOR FY 2019-20
 
Shift Register
Shift RegisterShift Register
Shift Register
 
TDS In Tally Erp 9
TDS In Tally Erp 9TDS In Tally Erp 9
TDS In Tally Erp 9
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
 

Viewers also liked

PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
Dalia Violeta Gutierrez Ruíz
 
Songwriting Unleashed
Songwriting UnleashedSongwriting Unleashed
Songwriting Unleashed
Daniel Mayo
 
А.Кумаков Apiship eRetailForum2015
А.Кумаков Apiship eRetailForum2015А.Кумаков Apiship eRetailForum2015
А.Кумаков Apiship eRetailForum2015
InSales
 
História em quadrinhos
História em quadrinhosHistória em quadrinhos
História em quadrinhos
Sérgio Lima
 
Виртуальный номер связывает филиалы в единую сеть
Виртуальный номер связывает филиалы в единую сетьВиртуальный номер связывает филиалы в единую сеть
Виртуальный номер связывает филиалы в единую сеть
Межрегиональный ТранзитТелеком | ОАО МТТ
 
Сколько стоит доступ в память, и что с этим делать
Сколько стоит доступ в память, и что с этим делатьСколько стоит доступ в память, и что с этим делать
Сколько стоит доступ в память, и что с этим делать
Qrator Labs
 
Capital budgeting
Capital budgetingCapital budgeting
Capital budgeting
Mirza Mohammed Karrar
 
DDoS Attacks - Scenery, Evolution and Mitigation
DDoS Attacks - Scenery, Evolution and MitigationDDoS Attacks - Scenery, Evolution and Mitigation
DDoS Attacks - Scenery, Evolution and Mitigation
Wilson Rogerio Lopes
 
WSO2-WSF-install-manual-linux-th
WSO2-WSF-install-manual-linux-thWSO2-WSF-install-manual-linux-th
WSO2-WSF-install-manual-linux-th
Infinity Levels Studio
 
DDoS Prevention: Market Growth, Deployments, and NSS Test Results
DDoS Prevention: Market Growth, Deployments, and NSS Test ResultsDDoS Prevention: Market Growth, Deployments, and NSS Test Results
DDoS Prevention: Market Growth, Deployments, and NSS Test Results
NSS Labs
 
Utilizando a Lousa Digital e o Projetor PROINFO
Utilizando a Lousa Digital e o Projetor PROINFOUtilizando a Lousa Digital e o Projetor PROINFO
Utilizando a Lousa Digital e o Projetor PROINFO
Sérgio Lima
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
PTtp WgWt
 
Latest resume ETA Aug 2016
Latest resume ETA Aug 2016Latest resume ETA Aug 2016
Latest resume ETA Aug 2016
senthil kumar
 

Viewers also liked (13)

PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
PROYECTO ESTADISTICA "FACTORES QUE INFLUYEN QUE LOS ESTUDIANTES DEL PL18 TEHU...
 
Songwriting Unleashed
Songwriting UnleashedSongwriting Unleashed
Songwriting Unleashed
 
А.Кумаков Apiship eRetailForum2015
А.Кумаков Apiship eRetailForum2015А.Кумаков Apiship eRetailForum2015
А.Кумаков Apiship eRetailForum2015
 
História em quadrinhos
História em quadrinhosHistória em quadrinhos
História em quadrinhos
 
Виртуальный номер связывает филиалы в единую сеть
Виртуальный номер связывает филиалы в единую сетьВиртуальный номер связывает филиалы в единую сеть
Виртуальный номер связывает филиалы в единую сеть
 
Сколько стоит доступ в память, и что с этим делать
Сколько стоит доступ в память, и что с этим делатьСколько стоит доступ в память, и что с этим делать
Сколько стоит доступ в память, и что с этим делать
 
Capital budgeting
Capital budgetingCapital budgeting
Capital budgeting
 
DDoS Attacks - Scenery, Evolution and Mitigation
DDoS Attacks - Scenery, Evolution and MitigationDDoS Attacks - Scenery, Evolution and Mitigation
DDoS Attacks - Scenery, Evolution and Mitigation
 
WSO2-WSF-install-manual-linux-th
WSO2-WSF-install-manual-linux-thWSO2-WSF-install-manual-linux-th
WSO2-WSF-install-manual-linux-th
 
DDoS Prevention: Market Growth, Deployments, and NSS Test Results
DDoS Prevention: Market Growth, Deployments, and NSS Test ResultsDDoS Prevention: Market Growth, Deployments, and NSS Test Results
DDoS Prevention: Market Growth, Deployments, and NSS Test Results
 
Utilizando a Lousa Digital e o Projetor PROINFO
Utilizando a Lousa Digital e o Projetor PROINFOUtilizando a Lousa Digital e o Projetor PROINFO
Utilizando a Lousa Digital e o Projetor PROINFO
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
Latest resume ETA Aug 2016
Latest resume ETA Aug 2016Latest resume ETA Aug 2016
Latest resume ETA Aug 2016
 

Recently uploaded

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 

Recently uploaded (20)

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 

Difference between Prefix & Postfix

  • 1. What is difference between Prefix & Postfix (++i ,--i & i++ , i--)
  • 2. So what is the difference???? Prefix Postfix The ++ or -- symbol is used before the variable. The ++ or -- symbol is used after the variable. Example: ++i or --i Exmple i++ or i-- It means : i= i+1 or It means: i= i+1 or i= i-1 i= i-1
  • 3. It will be easy for u to understand these if u keep two things in ur mind. That is : In prefix : First increment / decrement by 1 then assign . In postfix: First assign then increment/ decrement by 1 .
  • 4. In prefix: int i =5; ++i; Output: 6 It works like: i = ++i ; // First increment = i+1; = 5+1; = 6; int i = 6; // Then assign Note: In program the last & final value is accepted. In postfix: int i =5; i++; Output: 6 It works like: int i = 5; // First assign i =i++; // Then increment = i+1; = 5+1; =6; Note: In program the last & final value is accepted.
  • 5. **In prefix : First increment / decrement then assign** If i and j are two variables then : int i, j ; i=9; j=++i; Output: i & j is : 10 10 Here, Compiler first add 1 to the initial value i=9. Then it use the new incremented value in the same statement.
  • 6. **In prefix : First assign then increment / decrement ** If i and j are two variables then : int i, j ; i=9; j=i++; Output: i & j is : 10 9
  • 7. Try it yourself: - -i & i- - Hint: i = i -1;