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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:31:13+00:00 2026-05-28T04:31:13+00:00

Is that a valid expression? If so, can you rewrite it so that it

  • 0

Is that a valid expression? If so, can you rewrite it so that it makes more sense? For example, is it the same as (4 > y && y > 1)? How do you evaluate chained logical operators?

  • 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-28T04:31:13+00:00Added an answer on May 28, 2026 at 4:31 am

    The statement (4 > y > 1) is parsed as this:

    ((4 > y) > 1)
    

    The comparison operators < and > evaluate left-to-right.

    The 4 > y returns either 0 or 1 depending on if it’s true or not.

    Then the result is compared to 1.

    In this case, since 0 or 1 is never more than 1, the whole statement will always return false.


    There is one exception though:

    If y is a class and the > operator has been overloaded to do something unusual. Then anything goes.

    For example, this will fail to compile:

    class mytype{
    };
    
    mytype operator>(int x,const mytype &y){
        return mytype();
    }
    
    int main(){
    
        mytype y;
    
        cout << (4 > y > 1) << endl;
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Regular expression that matches valid IPv6 addresses Can any one know the
They said this expression is valid in C, and that it means calling a
Does anyone know where I can come by a regex that matches any valid
Update I want to have an expression (XPath, or Regex Expression, similar) that can
What is a good regular expression that can validate a text string to make
Can anyone help me create a regular expression that accepts alphanumeric (numbers and letters
I just learned from Peter Lawreys post that this is valid expression, and evaluates
I'm trying to create a regular expressions that will filter valid emails using PHP
I want to put an encrypted license list on the web, so that valid
I have a certificate for that is valid for *.MyCompany. com . That is

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.