

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are postfix operators in C++?
Postfix operators are unary operators that work on a single variable which can be used to increment or decrement a value by 1(unless overloaded). There are 2 postfix operators in C++, ++ and --.
In the postfix notation (i.e., i++), the value of i is incremented, but the value of the expression is the original value of i. So basically it first assigns a value to expression and then increments the variable. For example,
Example
#include<iostream> using namespace std; int main() { int j = 0, i = 10; // If we assign j to be i++, j will take i's current // value and i's value will be increatemnted by 1. j = i++; cout << j << ", " << i << "\n"; return 0; }
Output
This will give the output −
10, 11
- Related Questions & Answers
- What are postfix operators in C#?
- What is the difference between prefix and postfix operators in C++?
- Difference between prefix and postfix operators in C#?
- What are JavaScript Operators
- What are operators in JavaScript?
- What is Postfix Notation?
- What are JavaScript Bitwise Operators?
- What are relational operators in C#?
- What are unary operators in C#?
- What are assignment operators in C#?
- What are arithmetic operators in C#?
- What are bitwise operators in C#?
- What are Arithmetic Operators in JavaScript?
- What are Comparison Operators in JavaScript?
- What are Logical Operators in JavaScript?
Advertisements