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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:23:41+00:00 2026-05-24T10:23:41+00:00

Here is MSDN link From http://msdn.microsoft.com/en-us/library/s3f49ktz(v=VS.80).aspx It says: unsigned int : 4byte Range of

  • 0

Here is MSDN link
From http://msdn.microsoft.com/en-us/library/s3f49ktz(v=VS.80).aspx

It says:
unsigned int : 4byte
Range of Value 0 to 4,294,967,295

Hence my test code:

void main(void) 
{       
    unsigned int sum;   //4byte, 32bit
    sum = 2147483648;  //2^31 represent by 1 followed by 31 0s
    printf("sum is %d\n",sum); 
    sum = sum -1 ;     //2^31-1 represent by 0 followed by 31 1s
    printf("sum is %d\n",sum);
    getchar();
} 

I am sure 4,294,967,295=2^32-1, printf will print “0”, dump most significant bit
I think MSDN should wrote range of value: 0 to 2147483647
Is that right?

  • 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-24T10:23:42+00:00Added an answer on May 24, 2026 at 10:23 am

    That’s incorrect, if you want to get 4b you should do

    unsigned int sum;
    sum = 0;
    sum -= 1;
    

    Alternatively

    unsigned int sum = -1; // will give the same result
    

    This should give you the correct max value for an unsigned int (as hackish as that is). Also as others pointed out you should use %u as the formatter in your printf so that the value gets interpreted correctly.

    An unsigned int uses all bits as magnitude bits so the leading bit is no longer considered a sign bit so that becomes 2^32 – 1 instead of just 2^31 – 1

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

Sidebar

Related Questions

I just read this link http://msdn.microsoft.com/en-us/library/ms186243.aspx Here is the code to create table and
I tried getting AccExplorer32 from this link http://msdn.microsoft.com/en-us/library/dd631969.aspx and many others, but it says
I am trying to send data to DotNetOpenAuth website as described here http://msdn.microsoft.com/en-us/library/debx8sh9.aspx Sender
I am using this link http://msdn.microsoft.com/en-us/library/bb861909.aspx The adding a SafeControl to the web.config works
I checked out this link: http://msdn.microsoft.com/en-us/library/ff769510(v=VS.92).aspx But when I run the default windows phone
I'm trying to register an atl service using ExeName.exe /service as described here: http://msdn.microsoft.com/en-us/library/74y2334x(VS.80).aspx
I have scenario where thread updates form's control. I followed http://msdn.microsoft.com/en-us/library/ms171728.aspx to make it
I have a similar issue like here: http://social.msdn.microsoft.com/forums/en-US/biztalkgeneral/thread/87d5a6ec-04ee-4c6f-8267-f526ee105f0b I have an asp.net web page
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
I'm following the directions here: http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/0ce70e04-0ba0-4819-8898-87243203adb9/ to support mapping to a view that uses

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.