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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:49:16+00:00 2026-05-13T21:49:16+00:00

I have following array, that I need to operate by hand on bitmaps. const

  • 0

I have following array, that I need to operate by hand on bitmaps.

const unsigned int BITS[32] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 
                               2048, 4096, 8192, 16384, 32768, 65536, 131072, 
                               262144, 524288, 1048576, 2097152, 4194304, 
                               8388608, 16777216, 33554432, 67108864, 134217728, 
                               268435456, 536870912, 1073741824, 2147483648};

Unfortunately, when compiled I get

warning: this decimal constant is unsigned only in ISO C90

How can I remove this?

  • 1 1 Answer
  • 1 View
  • 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-13T21:49:17+00:00Added an answer on May 13, 2026 at 9:49 pm

    Integer literals in C are, by default, of type “signed int” (edit: but see comments for caveats). The last number there is too large to be represented as a signed 32-bit integer, and so you need to tell the compiler that it’s an unsigned integer by suffixing it with “U”, as:

    2147483648U
    

    Note that you can also add a suffix of “L” to make it a “long”, but on many systems that’s still 32-bit and thus irrelevant.

    Also, there’s a much less error-prone (and easier-to-read) way to write this code, with the bit-shift operator:

    const unsigned int BITS[32] = {1U, 1U<<1, 1U<<2, 1U<<3, 1U<<4,
                                   /* and so on */
                                   1U<<31};
    

    Or, writing in hexadecimal, if you don’t like bit shifts for some reason:

    const unsigned int BITS[32] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20,
                                   /* and so on */
                                   0x80000000U};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have an array numbers that contains the following values: int numbers
I have the following array that I need to recursively loop through and remove
I have the following array that I need to have sorted from highest score
I have an array of 128 booleans that represent bits. How can I convert
I have an array that looks like the following: array = [[1, 5], [4,
Lets say that i have the following array : float QuadVertices[4 * 2]; float
I have the following sort descriptors that sort an array of my business objects,
I have the following php code that gets a serialized array from a mysql
Assume I have an array of doubles that looks like the following: Array[10] =
I have an array that looks like the following when var_dump: array(3) { [0]=>

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.