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

  • Home
  • SEARCH
  • 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 843601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:09:17+00:00 2026-05-15T06:09:17+00:00

I want: 111 || 100 —> 111, not 1 100 && 100 —> 100,

  • 0

I want:

111 || 100  ---> 111,  not 1
100 && 100  ---> 100,  not 1
101 && 010  ---> 000,  not 0

Broken code

#include <stdio.h>

main(void){
        string hexa = 0xff;
        strig hexa2 = 0xf1;

        // CONVERT TO INT??? cast
        int hexa3 = hexa || hexa2;
        int hexa4 = hexa && hexa2;

        puts(hexa3);
        puts(hexa4);
}
  • 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-15T06:09:17+00:00Added an answer on May 15, 2026 at 6:09 am

    You want the bitwise operators (|, &) instead of the logical operators (||, &&):

    110 | 011 --> 111
    110 & 101 --> 100
    

    As for your broken code, you also have incorrect types for hexa and hexb which should both be numeric types:

    int hexa = 0xff;
    int hexa2 = 0xf1;
    

    Finally, to output an integer, you would use printf to format them:

    printf("hexa3 = 0x%08x\n", heaxa3);   // display as 8 digit, 0 padded hex
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to convert this hello@domain.com to &#104;&#101;&#108;&#108;&#111;&#064;&#100;&#111;&#109;&#097;&#105;&#110;&#046;&#099;&#111;&#109; I have tried: url_encode($string) this provides
I have two lists: link_ids = ['111','222','333'] filenames = ['111-foo.txt','111-bar.txt','222.txt'] I want to do
Want to code a key pad for an calculator. What I want to make
want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
userID point 111 20 111 30 222 40 222 50 I want to order
I using this code to resize an array to new size: I want to
I wrote the code for a basic Java Swing window and now I want
Possible Duplicate: Gray code in .NET I want to get Gray code of a
want to open pdf file when a user clicks on hyperlink shown in gridview
Want to run javascript function from parent window in child window Example I have

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.