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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:28:38+00:00 2026-05-27T22:28:38+00:00

In VC2008, I typed this code: int a = 2 + 1 & 0;

  • 0

In VC2008, I typed this code:

int a = 2 + 1 & 0;

and this expression’s result is
a = 0

Why the result is 0 but not 2?

  • 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-27T22:28:39+00:00Added an answer on May 27, 2026 at 10:28 pm

    Because the & operator is evaluated after the + operator and 3 & 0 equals 0.

    Of course you can place braces around the expressions to change the evaluation order. E.g:

    int a = 2 + (1 & 0);
    /* a == 2 */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented this code, but fail at compilation (VC2008 Express Ed.) : Now
The following simple piece of code, compiles with VC2008 but g++ rejects the code:
I'm using vc2008, writing some MFC code, I add a button, double click it,
Is VS2010, I analyzed my code and got this error: Warning 64 CA1050 :
I have tried to use this code in VS2008 (and may have included too
Consider the following code template<typename T, int N> struct A { typedef T value_type;
I have this sample code which generates the following warning (VS2008 compiler with SP1):
I need to generate .coverage file programmatic way. This post explains a C# code
This is my first post, I'm new to this site, but I've been lurking
I have this simple piece of code that uses boost::bind: #include <boost/bind.hpp> #include <utility>

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.