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 7938357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:47:27+00:00 2026-06-03T22:47:27+00:00

Why does the following expression evaluate to 0? i > –i Suppose i =

  • 0

Why does the following expression evaluate to 0?

i > --i

Suppose i = 5. Evaluating the expression from left to right, we evaluate the left operand (i) to get 5 and we evaluate the right operand (–i) to get 4. So the expression about should evaluate to 1. But when I compile it with gcc and run it, it always evaluates to 0. Is there a flaw in my thought process?

  • 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-06-03T22:47:29+00:00Added an answer on June 3, 2026 at 10:47 pm

    It’s simply undefined behaviour, since you are modifying the value of i as well as reading it without an intervening sequence point. The relational operator < does not introduce a sequence point.

    From C11, 6.5(2):

    If a side effect on a scalar object is unsequenced relative to either a different side effect on the same scalar object or a value computation using the value of the same scalar
    object, the behavior is undefined.

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

Sidebar

Related Questions

How does Python evaluate the following expression? anim1 gets executed after anim2 . How
why does the following js expression: test1 foo bar test2.replace(/foo.bar/, $') result in the
Why does the following code get the runtime error: Members of the Triggers collection
In the C language, why does the following expression fail? map = malloc(sizeof(Map) *
How does following expression evaluated? Student class : public class Student { private Integer
The following xpath does not seem to work: //FullName[sum(string-length(FirstName) | string-length(LastName))>= 30] Error: Expression
Confused about if condition, how does it executes following statements. if(1 && (1 ||
Does anyone know if the following expression will be possible in the next version(s)
I have the following expression for regex. Can someone tell me what it does?
I need to make a regular expression for php preg_match that does the following

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.