Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4017950
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:55:24+00:00 2026-05-20T09:55:24+00:00

I am not understanding the pre/post incrementing of this code example: int1 = 14;

  • 0

I am not understanding the pre/post incrementing of this code example:

int1 = 14;
int2 = ++int1;
// Assert: int1 == 15 && int2 == 15

In this pre-incrementing example why does int1 == 15? Why is int1 incremented and not just int2?

Then we have:

int1 = 14;
int2 = int1++;
// Assert: int1 == 15 && int2 == 14

In this post-incrementing example why does int2 == 14? Why is int2 not incremented but int1 is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:55:25+00:00Added an answer on May 20, 2026 at 9:55 am

    Both ++int1 and int1++ increment int1 because that’s what the increment operators do: they increment their operand.

    The reason that int2 is 15 in the first example and 14 in the second example because the pre-increment and post-increment operators differ in their return value: The post-increment operator increments the operand, but returns the value that the operand had before being incremented. The pre-increment operator returns the new value of the operand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's something wrong with my code or I'm just not understanding this fully. I
I am not understanding what the Number function does. This is the tutorial I'm
I've had this long term issue in not quite understanding how to implement a
It is my understanding that the java.regex package does not have support for named
It is my understanding that page level caching does not take into account that,
I'm just not understanding why things are being resized when I call the validate()
I am not understanding the point of using .def files with DLLs. It seems
It's my understanding that nulls are not indexable in DB2, so assuming we have
I'm not a beginner at C# but I really need to increase my understanding,
I have a basic understanding of mock and fake objects, but I'm not sure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.