Skip to content

Fix syntax error and format code in "Postfix Increment and Decrement Operators" #5503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
description: "Learn more about: Postfix Increment and Decrement Operators: ++ and --"
title: "Postfix Increment and Decrement Operators: ++ and --"
ms.date: "11/04/2016"
description: "Learn more about: Postfix Increment and Decrement Operators: ++ and --"
ms.date: 11/04/2016
f1_keywords: ["--", "++"]
helpviewer_keywords: ["increment operators [C++], syntax", "member-selection operators [C++]", "-- operator [C++], postfix decrement operators", "postfix operators [C++]", "++ operator [C++], postfix increment operators", "decrement operators [C++], syntax", "operators [C++], postfix", "decrement operators [C++]"]
ms.assetid: 0204d5c8-51b0-4108-b8a1-074c5754d89c
---
# Postfix Increment and Decrement Operators: `++` and `--`

Expand Down Expand Up @@ -43,19 +42,25 @@ The following code illustrates the postfix increment operator:
#include <iostream>
using namespace std;

int main() {
int i = 10;
cout << i++ << endl;
cout << i << endl;
int main()
{
int i = 10;
cout << i++ << endl;
cout << i << endl;
}
```

```Output
10
11
```

Postincrement and postdecrement operations on enumerated types are not supported:

```cpp
enum Compass { North, South, East, West );
enum Compass { North, South, East, West };
Compass myCompass;
for( myCompass = North; myCompass != West; myCompass++ ) // Error
for (myCompass = North; myCompass != West; myCompass++); // Error
```

## See also
Expand Down